Hello everyone! I am getting an error for which I can’t resolve by myself. I am getting the error : “TypeError: ‘Tensor’ object is not callable” and trying multiple solutions found online resulted no improvement.
My code is the following:
`tens = FaceBoxesBasicTransform(image)#nd array
print(tens.shape)
print(type(tens))
tens = Variable(torch.from_numpy(tens).unsqueeze(0))
if use_cuda:
tens = tens.cuda()
print(type(tens))#<------------- <class 'torch.Tensor'>
t1 = time.time()
y = net.apply(tens)# error here`
The net variable is from this class : `class FaceBox(nn.Module):
def __init__(self, cfg, phase='train'):
super(FaceBox, self).__init__()
self.phase = phase
# model
self.conv1 = nn.Conv2d(3, 24, kernel_size=7,
stride=4, padding=3, bias=False)
self.bn1 = nn.BatchNorm2d(24)
self.conv2 = nn.Conv2d(48, 64, kernel_size=5,
stride=2, padding=2, bias=False)
self.bn2 = nn.BatchNorm2d(64)
self.inception1 = Inception()
self.inception2 = Inception()
self.inception3 = Inception()
self.conv3_1 = conv_bn_relu(128, 128, kernel_size=1)
self.conv3_2 = conv_bn_relu(
128, 256, kernel_size=3, stride=2, padding=1)
self.conv4_1 = conv_bn_relu(256, 128, kernel_size=1)
self.conv4_2 = conv_bn_relu(
128, 256, kernel_size=3, stride=2, padding=1)
self.multilbox = MultiBoxLayer()
if self.phase == 'test':
self.softmax = nn.Softmax(dim=-1)
self.test_det = Detect(cfg)
@staticmethod
def forward(self, x):
img_size = x.size()[2:]
print(img_size)
source = []
print(img_size)
x = self.conv1(x)
x = self.bn1(x)
x = F.relu(torch.cat((F.relu(x), F.relu(-x)), 1))`
Thanks in advance for anyone who can help !