Hi, I have two input tensor like below.
input_blob_size = (1, 3, 1, 540, 960)
print(input_blob_size)
input_tensor = torch.randn(input_blob_size)
input_tensor2 = torch.randn(input_blob_size)
traced_model = torch.jit.trace(model, (input_tensor, input_tensor2), strict=False)
optimized_traced__model = optimize_for_mobile(traced_model)
but I got this error…
optimized_traced__model = optimize_for_mobile(traced_model)
File “/home/hsm/anaconda3/envs/reproducibleresearch/lib/python3.6/site-packages/torch/utils/mobile_optimizer.py”, line 65, in optimize_for_mobile
preserved_methods_str)
RuntimeError: Method ‘forward’ is not defined.
I want to use two inputs, rather than one input.
Can I do it?
This is my model snipet.
class ResNet50_forward2(torch.nn.Module):
def __init__(self):
super(ResNet50_forward2, self).__init__()
self.batch = nn.Sequential(*list(models.mobilenet_v3_small(pretrained=True).children())[0])
def forward(self, pixel, pixel2):
raw_read = torch.cat((pixel, pixel2), 0)
print("DL1", raw_read.shape) #batch x chan x fr x w x h
return raw_read