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

Shape inference for Reverse doesn't support unknown shape #2690

Closed
yaroslavvb opened this issue Jun 6, 2016 · 3 comments
Closed

Shape inference for Reverse doesn't support unknown shape #2690

yaroslavvb opened this issue Jun 6, 2016 · 3 comments
Assignees

Comments

@yaroslavvb
Copy link
Contributor

This crashes

import tensorflow as tf
dims = tf.placeholder(tf.bool)
tensor = tf.placeholder(tf.int32)
result = tf.reverse(tensor, dims)
print(result.get_shape())

Stack trace


  File "/Users/yaroslavvb/tfimmediate_macbook/tensorflow/bazel-bin/tensorflow/contrib/immediate/env_extra_test.runfiles/org_tensorflow/tensorflow/contrib/immediate/python/immediate/env_extra_test.py", line 39, in testReverse
    result = tf.reverse(tensor, dims)
  File "/Users/yaroslavvb/tfimmediate_macbook/tensorflow/bazel-bin/tensorflow/contrib/immediate/env_extra_test.runfiles/org_tensorflow/tensorflow/python/ops/gen_array_ops.py", line 1405, in reverse
    name=name)
  File "/Users/yaroslavvb/tfimmediate_macbook/tensorflow/bazel-bin/tensorflow/contrib/immediate/env_extra_test.runfiles/org_tensorflow/tensorflow/python/ops/op_def_library.py", line 704, in apply_op
    op_def=op_def)
  File "/Users/yaroslavvb/tfimmediate_macbook/tensorflow/bazel-bin/tensorflow/contrib/immediate/env_extra_test.runfiles/org_tensorflow/tensorflow/python/framework/ops.py", line 2251, in create_op
    set_shapes_for_outputs(ret)
  File "/Users/yaroslavvb/tfimmediate_macbook/tensorflow/bazel-bin/tensorflow/contrib/immediate/env_extra_test.runfiles/org_tensorflow/tensorflow/python/framework/ops.py", line 1696, in set_shapes_for_outputs
    shapes = shape_func(op)
  File "/Users/yaroslavvb/tfimmediate_macbook/tensorflow/bazel-bin/tensorflow/contrib/immediate/env_extra_test.runfiles/org_tensorflow/tensorflow/python/ops/array_ops.py", line 631, in _ReverseShape
    input_shape = op.inputs[0].get_shape().with_rank(dims_shape[0])
  File "/Users/yaroslavvb/tfimmediate_macbook/tensorflow/bazel-bin/tensorflow/contrib/immediate/env_extra_test.runfiles/org_tensorflow/tensorflow/python/framework/tensor_shape.py", line 639, in with_rank
    return self.merge_with(unknown_shape(ndims=rank))
  File "/Users/yaroslavvb/tfimmediate_macbook/tensorflow/bazel-bin/tensorflow/contrib/immediate/env_extra_test.runfiles/org_tensorflow/tensorflow/python/framework/tensor_shape.py", line 816, in unknown_shape
    return TensorShape([Dimension(None)] * ndims)
TypeError: __index__ returned non-(int,long) (type NoneType)
> /Users/yaroslavvb/tfimmediate_macbook/tensorflow/bazel-bin/tensorflow/contrib/immediate/env_extra_test.runfiles/org_tensorflow/tensorflow/python/framework/tensor_shape.py(816)unknown_shape()
-> return TensorShape([Dimension(None)] * ndims)

@mrry
Copy link
Contributor

mrry commented Jun 6, 2016

Fix incoming shortly....

@girving girving added the triaged label Jun 6, 2016
@vrv vrv closed this as completed in 14e425c Jun 7, 2016
@vanpersie32
Copy link

vanpersie32 commented Jul 5, 2017

@mrry @girving @ry hi merry, sorry to bother you. It seems that the problem still occurs in the latest tensorflow 1.2.1. I run the code provided by @yaroslavvb and get the errors.
1

I use ubuntu 14.04 , tensorflow-gpu 1.2.1, titianx-black

@girving
Copy link
Contributor

girving commented Jul 5, 2017

@vanpersie32 That error is unrelated: the calling convention of tf.reverse changed with 1.0 to match numpy. See https://www.tensorflow.org/api_docs/python/tf/reverse.

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

4 participants