Pytorch 尝试将onnx文件转换为caffe2时发生运算符转换错误
我在pytorch上训练了一个对象检测模型,并将其导出到onnx文件 我想将其转换为caffe2模型:Pytorch 尝试将onnx文件转换为caffe2时发生运算符转换错误,pytorch,onnx,caffe2,Pytorch,Onnx,Caffe2,我在pytorch上训练了一个对象检测模型,并将其导出到onnx文件 我想将其转换为caffe2模型: import onnx import caffe2.python.onnx.backend as onnx_caffe2_backend # Load the ONNX ModelProto object. model is a standard Python protobuf object model = onnx.load("CPU4export.onnx") # prepare t
import onnx
import caffe2.python.onnx.backend as onnx_caffe2_backend
# Load the ONNX ModelProto object. model is a standard Python protobuf object
model = onnx.load("CPU4export.onnx")
# prepare the caffe2 backend for executing the model this converts the ONNX model into a
# Caffe2 NetDef that can execute it. Other ONNX backends, like one for CNTK will be
# availiable soon.
prepared_backend = onnx_caffe2_backend.prepare(model)
# run the model in Caffe2
# Construct a map from input names to Tensor data.
# The graph of the model itself contains inputs for all weight parameters, after the input image.
# Since the weights are already embedded, we just need to pass the input image.
# Set the first input.
W = {model.graph.input[0].name: x.data.numpy()}
# Run the Caffe2 net:
c2_out = prepared_backend.run(W)[0]
# Verify the numerical correctness upto 3 decimal places
np.testing.assert_almost_equal(torch_out.data.cpu().numpy(), c2_out, decimal=3)
print("Exported model has been executed on Caffe2 backend, and the result looks good!")
我总是犯这样的错误:
RuntimeError: ONNX conversion failed, encountered 1 errors:
Error while processing node: input: "90"
input: "91"
output: "92"
op_type: "Resize"
attribute {
name: "mode"
s: "nearest"
type: STRING
}
. Exception: Don't know how to translate op Resize
我怎样才能解决它 问题在于,还不支持Resize操作符的导出
请--有一个活跃的开发人员社区应该能够解决这个用例。问题是,还不支持Resize操作符的导出
请--有一个活跃的开发人员社区应该能够解决这个用例