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

Always return a tuple from ops.shape #722

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

mattdangerw
Copy link
Member

@mattdangerw mattdangerw commented Aug 14, 2023

This was already true in all contexts except when called on tf.Tensors on the Tensorflow backend. In this case, we were returning a 1-D tf.Tensor.

This was leading to some weird incongruencies, e.g.

# On Jax.
ops.shape(np.ones((1, 2))) + (3,)
> (1, 2, 3)

# On TensorFlow.
ops.shape(np.ones((1, 2))) + (3,)
> tf.Tensor([4, 5])

This was already true in all contexts except when called on
`tf.Tensor`s on the Tensorflow backend. In this case, we were
returning a 1-D `tf.Tensor`.

This was leading to some weird incongruencies, e.g.
```python
ops.shape(np.ones(1, 2)) + (3,)
> (1, 2, 3)

ops.shape(np.ones(1, 2)) + (3,)
> tf.Tensor([4, 5])
```
Copy link
Contributor

@fchollet fchollet left a comment

Choose a reason for hiding this comment

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

LGTM, thank you

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