Skip to content
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

when shape contains negative integer, input_variable should throw an error #3885

Open
cheyennee opened this issue Dec 8, 2023 · 1 comment

Comments

@cheyennee
Copy link

In following code, I want to generate an input. However, when the input shape contains a negative integer, the code wont throw errors. It just prints Input('Input3', [#], [1 x ? x 1]). This behaviour is quite different from other deep learning libraries. I think it would be better if there is input shape checking.

repo code:

x = C.input_variable((1, -1, 1), needs_gradient=True)
print(x)
@Humayun-glitch
Copy link

The issue you're encountering might be related to how CNTK handles negative integers in input shapes. In CNTK, the negative dimension is often used as a placeholder for sequences or variable-length dimensions. While other deep learning libraries might raise an error when encountering negative integers, CNTK might interpret it differently.

In your case, the shape (1, -1, 1) is likely interpreted as a sequence of vectors with one element, where the second dimension can vary in size (variable-length sequence), and each element has one value. This is a valid usage in CNTK for dealing with sequences.

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

No branches or pull requests

2 participants