-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resize op convert to FP16 fail #272
Comments
@xiaowuhu @xadupre @skottmckay |
The model you shared cannot be accessed. Can you try something like: import onnx
m1 = onnx.load("<first model>")
print([n for n in m1.graph.node if n.op_type == "Resize"])
m2 = onnx.load("<second model>")
print([n for n in m1.graph.node if n.op_type == "Resize"]) My guess is the operartor Resize changed in opset 13 but the tool was not tested for the new version. |
first model: [input: "BiseNetV2/aggregation_branch/guided_aggregation_block/semantic_branch/3x3_conv_block/bn/FusedBatchNormV3:0"
input: "roi__879"
input: "roi__879"
input: "Concat__796:0"
output: "Resize__797:0"
name: "Resize__797"
op_type: "Resize"
attribute {
name: "coordinate_transformation_mode"
s: "asymmetric"
type: STRING
}
attribute {
name: "exclude_outside"
i: 0
type: INT
}
attribute {
name: "mode"
s: "linear"
type: STRING
}
attribute {
name: "nearest_mode"
s: "floor"
type: STRING
}
domain: ""
, input: "BiseNetV2/aggregation_branch/guided_aggregation_block/aggregation_features/guided_semantic_features:0"
input: "roi__879"
input: "roi__879"
input: "Concat__845:0"
output: "Resize__846:0"
name: "Resize__846"
op_type: "Resize"
attribute {
name: "coordinate_transformation_mode"
s: "asymmetric"
type: STRING
}
attribute {
name: "exclude_outside"
i: 0
type: INT
}
attribute {
name: "mode"
s: "linear"
type: STRING
}
attribute {
name: "nearest_mode"
s: "floor"
type: STRING
}
domain: ""
, input: "BiseNetV2/logits/1x1_conv_block/Conv2D:0"
input: "roi__879"
input: "roi__879"
input: "Concat__887:0"
output: "Resize__888:0"
name: "Resize__888"
op_type: "Resize"
attribute {
name: "coordinate_transformation_mode"
s: "asymmetric"
type: STRING
}
attribute {
name: "exclude_outside"
i: 0
type: INT
}
attribute {
name: "mode"
s: "linear"
type: STRING
}
attribute {
name: "nearest_mode"
s: "floor"
type: STRING
}
domain: ""
] [input: "Resize__797_input_cast_0"
input: "Resize__797_input_cast_1"
input: "Resize__797_input_cast_2"
input: "Concat__796:0"
output: "Resize__797_output_cast_0"
name: "Resize__797"
op_type: "Resize"
attribute {
name: "coordinate_transformation_mode"
s: "asymmetric"
type: STRING
}
attribute {
name: "exclude_outside"
i: 0
type: INT
}
attribute {
name: "mode"
s: "linear"
type: STRING
}
attribute {
name: "nearest_mode"
s: "floor"
type: STRING
}
domain: ""
, input: "Resize__846_input_cast_0"
input: "Resize__846_input_cast_1"
input: "Resize__846_input_cast_2"
input: "Concat__845:0"
output: "Resize__846_output_cast_0"
name: "Resize__846"
op_type: "Resize"
attribute {
name: "coordinate_transformation_mode"
s: "asymmetric"
type: STRING
}
attribute {
name: "exclude_outside"
i: 0
type: INT
}
attribute {
name: "mode"
s: "linear"
type: STRING
}
attribute {
name: "nearest_mode"
s: "floor"
type: STRING
}
domain: ""
, input: "Resize__888_input_cast_0"
input: "Resize__888_input_cast_1"
input: "Resize__888_input_cast_2"
input: "Concat__887:0"
output: "Resize__888_output_cast_0"
name: "Resize__888"
op_type: "Resize"
attribute {
name: "coordinate_transformation_mode"
s: "asymmetric"
type: STRING
}
attribute {
name: "exclude_outside"
i: 0
type: INT
}
attribute {
name: "mode"
s: "linear"
type: STRING
}
attribute {
name: "nearest_mode"
s: "floor"
type: STRING
}
domain: ""
] The 2 models are converted from tensorflow-onn with opset 15. Try to use opset 12, the fp16 model can create session, but don't have result when predict. All model in GoogleDrive |
@xadupre So I try to delete the parameters, use nodes = onnx_model.graph.node
node_delete_list = []
for i, node in enumerate(nodes[:]):
node_op_type = node.op_type
if node.op_type == "Resize":
attrs = node.input
for j, attr in enumerate(attrs[:]):
if 'const_empty_' in attr:
node_delete_list.append(attr)
nodes[i].input[j] = '' The RESIZE OP are changed like: The fp16 model can create session, but don't have result. |
There is a model from tensorflow2onnx, the FP32 model can run successfully.
Then use
float16_converter.convert_float_to_float16(onnx_model, keep_io_types=True)
convert to FP16 model.But the FP16 model can't create session, error:
onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Load model from model_fp16.onnx failed:Node (Resize__846) Op (Resize) [ShapeInferenceError] Either sizes or scales must be provided, but not both of them
The problem is similar with #266.
How to solve it ?
The text was updated successfully, but these errors were encountered: