Skip to content

Conversation

@jignparm
Copy link
Contributor

@jignparm jignparm commented Jun 2, 2020

The input data shape may contain -1 in one of the dimensions, so the shape is not always known before hand.

This PR handles the scenario of a -1 in the shape, which is required by MatrixDiagSetV3

xstart_2 = ctx.make_node('Cast', [xstart_1.output[0]], attr={'to': TensorProto.INT64})
xstart_3 = ctx.make_node('Add', [xstart_2.output[0], const_neg_one])
xstart_4 = ctx.make_node('Range', [k1_scalar.output[0], xstart_3.output[0], const_neg_one])
xstart_4 = ctx.make_node('Range', [k1_scalar, xstart_3.output[0], const_neg_one])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is const_neg_one a scalar?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a scalar, but it seems to work successfully with Range() function in opset 11 (i.e. unit tests pass).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if I am with opset 12 then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both opset 11 and 12 are passing unit tests (see checks).

@jignparm jignparm merged commit 4a3c491 into onnx:master Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants