Skip to content

Keyword arg not respected and was treated as positional arg #1566

Open
@vincentme

Description

@vincentme

behavior

I specified scales = [2.0, 2.0] in op.Resize. Evaluation works in onnxscript itself, but after export to modelproto and run by onnx ReferenceEvaluator or onnxruntime, error occurs and seems that the parameter [2.0, 2.0] was set to roi, scale_factors and output_size are both None.

code to reproduce

from onnxscript import FLOAT, script, opset20 as op
import numpy as np

@script()
def test(img_in: FLOAT["row", "col"]) -> FLOAT["row", "col"]:
    img_out = op.Resize(img_in, scales = [2.0, 2.0], mode = 'linear')
    # img_out = op.Resize(img_in, sizes = [512, 512], mode = 'linear')
    return img_out

img_in = np.random.randn(128, 256).astype(np.float32)
img_out = test(img_in)
model = test.to_model_proto()

from onnx.reference import ReferenceEvaluator
sess = ReferenceEvaluator(model)
feeds = {'img_in': img_in,}
outpus = sess.run(None, feeds)

from onnxruntime import InferenceSession
sess = InferenceSession(model.SerializeToString())
feeds = {'img_in': img_in,}
outpus = sess.run(None, feeds)

error message

raise ValueError("output_size is None and scale_factors is None.")

ValueError: output_size is None and scale_factors is None.

图片

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions