AttributeError: 'Tensor' object has no attribute 'numpy' #1763
Unanswered
estheroratemstet
asked this question in
Q&A
Replies: 2 comments
-
Hi @estheroratemstet Can you share more information? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @estheroratemstet I was able to reproduce your error by disabling TensorFlow eager execution. You can solve this problem by enabling eager execution or upgrading Tensorflow to version 2.2.0 or above (because it is enabled by default) Either import tensorflow as tf
tf.enable_eager_execution() or |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
AttributeError: 'Tensor' object has no attribute 'numpy'
someone has this problem in notebook v2 / know what can be the problem
the error on this line:
patch, patch_mask = ap.generate(x=images, y=y_target)
THE CODE CELL:
ap = AdversarialPatch(classifier=tfc, rotation_max=rotation_max, scale_min=scale_min, scale_max=scale_max,
learning_rate=learning_rate, max_iter=max_iter, batch_size=batch_size,
patch_shape=(128, 128, 3))
label = name_to_label(target_name)
y_one_hot = np.zeros(nb_classes)
y_one_hot[label] = 1.0
y_target = np.tile(y_one_hot, (images.shape[0], 1))
patch, patch_mask = ap.generate(x=images, y=y_target)
THE TYPE OF images AND y_target WAS :
<class 'numpy.ndarray'>
Beta Was this translation helpful? Give feedback.
All reactions