S. Takano
S. Takano

Reputation: 313

AttributeError: 'numpy.dtype' object has no attribute 'is_floating'

I develop my own op using eager execution. I met an error. How to fix it?

Env: Colaboratory TF ver.: 1.14

I use:

mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)

I tried tf.convert_to_tensor() but it led to other error. Error caused by:

loss_value, grads = grad(x_, y)

Error message:

    962     flat_sources = [_handle_or_self(x) for x in flat_sources]
    963     for t in flat_sources_raw:
--> 964       if not t.dtype.is_floating:
    965         logging.vlog(
    966             logging.WARN, "The dtype of the source tensor must be "

AttributeError: 'numpy.dtype' object has no attribute 'is_floating'

Upvotes: 1

Views: 3430

Answers (1)

S. Takano
S. Takano

Reputation: 313

I got that reason of the error which indicates "if not is_floating" for the raising the exception.

To solve the error, it needs to make variable to a tensor, just using convert_to_tensor() before an operation.

Upvotes: 1

Related Questions