RuntimeError: Could not infer dtype of ImplicitA

hello, i am trying to add implicit in my code
i want to convert imA into tensor but i got this error.

def forward(self, x):
    _, _, H, W = x.size()
    imA = torch.tensor(ImplicitA(channel=2048))
    backbone_out = self.backbone(x) + imA()
    segmentation_head_out = self.segmentation_head(backbone_out)
    y = segmentation_head_out
    return y

please help!

Could you describe what ImplicitA is? Are you creating a new object and are trying to convert it to a tensor e.g. via:

class ImplicitA(object):
    def __init__(self):

# > RuntimeError: Could not infer dtype of ImplicitA

i am using Implicit knowledge.
i make a class like

class ImplicitA(nn.Module):
def init(self, channel):
super(ImplicitA, self).init() = channel
self.implicit = nn.Parameter(torch.zeros(1, channel, 1, 1))
nn.init.normal_(self.implicit, std=.02)

now i want to add my backbone output and implicit but I got that error.

I’m unsure what exactly you are trying to achieve, but you cannot transform an nn.Module to a tensor via:

imA = torch.tensor(ImplicitA(channel=2048))

actually I solve this error.