onnx: Got error with upsampling operation
my implementation is below…
import onnx
from onnx import helper
from onnx import TensorProto
import numpy as np
data = np.array([[[
[1, 2],
[3, 4],
]]], dtype=np.float32)
scales = np.array([1.0, 1.0, 2.0, 3.0], dtype=np.float32)
inputs = list()
input_tensor = helper.make_tensor_value_info(
'x', TensorProto.FLOAT, data.shape)
scale_tensor = helper.make_tensor_value_info(
'scales', TensorProto.FLOAT, (4,))
inputs.append(input_tensor)
inputs.append(scale_tensor)
initializers = list()
initializers.append(helper.make_tensor('scales', TensorProto.FLOAT, scales.shape, scales))
graph = helper.make_graph(
nodes=[helper.make_node("Upsample", ['x', 'scales'], ['y'])],
name='UPSAMPLE-TEST',
inputs=inputs,
outputs=[],
initializer=initializers)
model_def = helper.make_model(graph)
onnx.checker.check_model(model_def)
and I got the output
onnx.onnx_cpp2py_export.checker.ValidationError: Input size 2 not in range [min=1, max=1].
==> Context: Bad node spec: input: "x" input: "scales" output: "y" op_type: "Upsample"
I can’t understand error message…any hint? Thanks!
my onnx version is 1.3.0 with python 2.7.15.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 15
@xxradon Very nice, THX.