Open diegogranziol opened 1 year ago
With pytorch==1.12.1 and torchvision==0.13.1, I get an error when calling into torch.jit.trace
before ct.convert
is even called. I think this is an issue with torch or with this model. I don't think this is a coremltools error.
🐞Describing the bug
Stack Trace
ValueError: tensor should have value of type ndarray, got <class 'numpy.float32'> instead
To Reproduce
class Wrapped(nn.Module): def init(self): super(Wrapped, self).init() self.model = model.eval() def forward(self, x): res = self.model(x)
Extract the tensor we want from the output dictionary
new_model = Wrapped().eval() traced_model = torch.jit.trace(new_model,image) mlmodel = ct.convert(traced_model, inputs=[ct.TensorType(shape=[1,3, 400, 400])], source="pytorch", convert_to="mlprogram")