Skip to content

Mask-rcnn torchscript doesn't load in Android: Unknown builtin op: torchvision::_new_empty_tensor_op #2762

Closed
@shehroz010

Description

@shehroz010

I have trained a faster rcnn model on a custom dataset but, when I try to take trace of the model using jit.trace() it throws some errors. So I tried jit.script(). It works but when I try to load it into an android module it fails and throws and error
"could not find a similar ops to torchvision: :_new_empty_tensor_op .This op may not exist or may not be currently supported in TorchScript".

Below is the image of the jit.script() issue while loading it into android module
image

For the second issue when I use jit.trace() is throws an runtime error even I change the input to cuda type

Code:

example = torch.rand(1, 3, 224, 224)
examplex = example.to('cuda')
model_trace = torch.jit.trace(modelx, examplex)

Error

RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!

Any help will be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions