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

Fixed NotImplementedError: Cannot convert a symbolic Tensor to a numpy array #47957

Merged
merged 1 commit into from Jun 11, 2021

Conversation

petronny
Copy link
Contributor

@petronny petronny commented Mar 21, 2021

Fixed #9706

Implemented as mentioned in tensorflow/models#9706 (comment) and tensorflow/models#9706 (comment) .

This problem happens with tensorflow 2.4.1 and numpy 1.20.1 .
Minimal code to reproduce the problem:

from tensorflow.keras.models import Sequential
from tensorflow.keras import layers
model = Sequential()
model.add(layers.LSTM(256, return_sequences=True))
model.build((10,20,30))
model.summary()

@google-ml-butler google-ml-butler bot added the size:XS CL Change Size: Extra Small label Mar 21, 2021
@google-cla
Copy link

google-cla bot commented Mar 21, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label Mar 21, 2021
@petronny
Copy link
Contributor Author

@googlebot I signed it!

@google-cla google-cla bot added cla: yes and removed cla: no labels Mar 21, 2021
@gbaned gbaned self-assigned this Mar 21, 2021
@gbaned gbaned added the comp:ops OPs related issues label Mar 21, 2021
@gbaned gbaned added this to Assigned Reviewer in PR Queue via automation Mar 21, 2021
@gbaned gbaned requested a review from skye March 21, 2021 16:28
@google-ml-butler google-ml-butler bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Mar 21, 2021
PR Queue automation moved this from Assigned Reviewer to Approved by Reviewer Mar 21, 2021
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Mar 21, 2021
@gbaned gbaned added the kokoro:force-run Tests on submitted change label Mar 22, 2021
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Mar 22, 2021
@mihaimaruseac mihaimaruseac added the kokoro:force-run Tests on submitted change label Mar 23, 2021
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Mar 23, 2021
@gbaned
Copy link
Contributor

gbaned commented Mar 24, 2021

@petronny Can you please check build failures. Thanks!

@gbaned gbaned removed the ready to pull PR ready for merge process label Mar 24, 2021
@petronny
Copy link
Contributor Author

petronny commented Mar 24, 2021

I think the main error is:

ERROR: testImplementsAttributeAssertsOnSideInput (__main__.FunctionTest)
testImplementsAttributeAssertsOnSideInput (__main__.FunctionTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/b/f/w/bazel-out/k8-opt/bin/tensorflow/python/eager/function_test.runfiles/org_tensorflow/tensorflow/python/ops/array_ops.py", line 3219, in ones
    tensor_shape.TensorShape(shape))
  File "/b/f/w/bazel-out/k8-opt/bin/tensorflow/python/eager/function_test.runfiles/org_tensorflow/tensorflow/python/framework/tensor_shape.py", line 762, in __init__
    self._dims = [Dimension(d) for d in dims]
  File "/b/f/w/bazel-out/k8-opt/bin/tensorflow/python/eager/function_test.runfiles/org_tensorflow/tensorflow/python/framework/tensor_shape.py", line 762, in <listcomp>
    self._dims = [Dimension(d) for d in dims]
  File "/b/f/w/bazel-out/k8-opt/bin/tensorflow/python/eager/function_test.runfiles/org_tensorflow/tensorflow/python/framework/tensor_shape.py", line 206, in __init__
    .format(value, type(value))), None)
  File "<string>", line 3, in raise_from
TypeError: Dimension value must be integer or None or have an __index__ method, got value '1.0' with type '<class 'float'>'

I guess it shoule be 1 with type 'int' instead of 1.0 with type 'float'.

Is there a way to easily run the testImplementsAttributeAssertsOnSideInput test on my local machine?
Then I can try to dig this error out.

@mihaimaruseac
Copy link
Collaborator

bazel test //path/to/the/test:test_target (need to look in the BUILD files to get the test target name)

@gbaned
Copy link
Contributor

gbaned commented Mar 30, 2021

@petronny Can you please check @mihaimaruseac's comments and keep us posted ? Thanks!

@petronny
Copy link
Contributor Author

petronny commented Apr 1, 2021

I will take a look after 2 weeks.

@gbaned gbaned added the stat:awaiting response Status - Awaiting response from author label Apr 1, 2021
@gbaned gbaned added awaiting review Pull request awaiting review and removed stat:awaiting response Status - Awaiting response from author labels Apr 14, 2021
@gbaned gbaned requested a review from mihaimaruseac May 26, 2021 11:16
@csachs
Copy link
Contributor

csachs commented Jun 8, 2021

CI looks better now, I think, can someone take a look?

@google-ml-butler google-ml-butler bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Jun 8, 2021
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Jun 8, 2021
@gbaned gbaned removed the ready to pull PR ready for merge process label Jun 10, 2021
@google-ml-butler google-ml-butler bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Jun 10, 2021
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Jun 10, 2021
@gbaned gbaned removed the ready to pull PR ready for merge process label Jun 11, 2021
@google-ml-butler google-ml-butler bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Jun 11, 2021
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Jun 11, 2021
@copybara-service copybara-service bot merged commit b258941 into tensorflow:master Jun 11, 2021
PR Queue automation moved this from Approved by Reviewer to Merged Jun 11, 2021
@risicle
Copy link

risicle commented Jul 22, 2021

Is this likely to get a stable backport?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes comp:ops OPs related issues ready to pull PR ready for merge process size:XS CL Change Size: Extra Small
Projects
PR Queue
  
Merged
Development

Successfully merging this pull request may close these issues.

None yet

6 participants