CCNet icon indicating copy to clipboard operation
CCNet copied to clipboard

cc_attention def INF

Open ZhangJT0127 opened this issue 3 years ago • 3 comments

why use INF function?i want to know that.

ZhangJT0127 avatar May 07 '21 08:05 ZhangJT0127

@ZhangJT0127 论文中注意力图的其中一个维度是H+W-1,这是因为计算了两次自身所以要减去,在代码中直接使用INF函数来生成负无穷并加在energy_H上,这样使用softmax时就消除了两次计算自身的影响

Asthestarsfalll avatar Aug 17 '21 08:08 Asthestarsfalll

@ZhangJT0127 论文中注意力图的其中一个维度是H+W-1,这是因为计算了两次自身所以要减去,在代码中直接使用INF函数来生成负无穷并加在energy_H上,这样使用softmax时就消除了两次计算自身的影响

Is there an another method? the torch.diag methon isn't supported by onnx version and when i use torch.eye ,my tensorrt doesn‘t support it either.

Thatboy7 avatar Jul 11 '22 02:07 Thatboy7

@ZhangJT0127 论文中注意力图的其中一个维度是H+W-1,这是因为计算了两次自身所以要减去,在代码中直接使用INF函数来生成负无穷并加在energy_H上,这样使用softmax时就消除了两次计算自身的影响

Is there an another method? the torch.diag methon isn't supported by onnx version and when i use torch.eye ,my tensorrt doesn‘t support it either.

Thatboy7 avatar Jul 11 '22 02:07 Thatboy7