You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
model = PredictModel(**vars(args))
model.eval()
ckpt = torch.load("ckpt/hitnet_sf_finalpass.ckpt")
# for name in ckpt['state_dict']:
# print('name is {}'.format(name))
model.load_state_dict(ckpt["state_dict"])
device = torch.device("cuda")
model = model.to(device)
input_names = ["input0"]#,"input1"
#output_names = ["output0"]
output_names=["output_%d" % i for i in range(1)]
#output_names = ["output0","output1","output2","output3"]
print(output_names)
left = torch.randn(1, 3, 480, 640).to(device)
right = torch.randn(1, 3, 480, 640).to(device)
a=(left, right)
export_onnx_file = "./HITNet_SF_5.onnx"
# torch_out = torch.onnx._export(model(left,right),(left,right), output_onnx, export_params=True, verbose=False,
# input_names=input_names, output_names=output_names)
torch_out = torch.onnx.export(model,args=(left,right),f=export_onnx_file,verbose=False,input_names=input_names,
output_names=output_names, export_params=True,opset_version=11)
`
I use the above code to export onnx and can get an onnx model of about 1.9M python3 -m onnxsim HITNet_SF_5.onnx HITNet_SF_5-smi.onnx
When I optimized the onnx model, the following error occurred. After investigation, it was found that the max operation caused the optimization error;
How to solve it please, thank you!
The text was updated successfully, but these errors were encountered:
@zjjMaiMai
`
parser.add_argument("--images", nargs=2, required=False)
parser.add_argument("--model", type=str, default="HITNet_SF")
parser.add_argument("--ckpt", type=str, default="ckpt/hitnet_sf_finalpass.ckpt")
parser.add_argument("--width", type=int, default=None)
parser.add_argument("--output", default="./")
args = parser.parse_args()
I use the above code to export onnx and can get an onnx model of about 1.9M
python3 -m onnxsim HITNet_SF_5.onnx HITNet_SF_5-smi.onnx
When I optimized the onnx model, the following error occurred. After investigation, it was found that the max operation caused the optimization error;
How to solve it please, thank you!
The text was updated successfully, but these errors were encountered: