关于使用PSA模块时报错

Author: nlper01Created Sep 12, 2022Updated Sep 19, 2023

大佬,我在使用PSA.py这个模块时,老是报错 RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same, 我已经把这个模块.cuda()

    input=torch.randn(50,512,7,7).cuda()
    psa = PSA(channel=512,reduction=8).cuda()
    output=psa(input)
    a=output.view(-1).sum()
    a.backward()
    print(output.shape)

还是报错,能解决一下吗?

Source: xmu-xiaoma666/External-Attention-pytorch