tensorflow: The input type of the tf.math.sqrt operator parameters does not match the exception information.

Click to expand!

Issue Type

Bug

Source

source

Tensorflow Version

TF 2.4

Custom Code

Yes

OS Platform and Distribution

windows 11

Mobile device

No response

Python version

3.8.15

Bazel version

No response

GCC/Compiler version

No response

CUDA/cuDNN version

CUDA: 11.2 cuDNN 8.1

GPU model and memory

RTX3060

Current Behaviour?

In the official document, the input types of tf.math.sqrt operator parameters are bfloat16, half, float32, float64.. It can be seen that the above does not contain complex64 or complex128 types, but in the following test code, the exception thrown In the information, you can see that the input can be of type complex64 or complex128. It is hoped that the documentation can be modified or the exception information can be modified.

Standalone code to reproduce the issue

    import tensorflow as tf

    input = "True"
    out = tf.math.sqrt(input)
    print(out)

Relevant log output

tensorflow.python.framework.errors_impl.InvalidArgumentError: Value for attr 'T' of string is not in the list of allowed values: bfloat16, half, float, double, complex64, complex128
	; NodeDef: {{node Sqrt}}; Op<name=Sqrt; signature=x:T -> y:T; attr=T:type,allowed=[DT_BFLOAT16, DT_HALF, DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128]> [Op:Sqrt]

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

@cantonios one of these days it could be nice if we could directly generate these from the ops def GT.

Yes, I know. They are generated for some ops - just not ones that have their own python docstrings. Otherwise, a check to detect when the docs are stale would be useful.