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

tf.raw_ops.ApproximateEqual/Erfinv fail support a few data types, inconsistent with the documentation #64256

Open
drewshark opened this issue Mar 22, 2024 · 4 comments · May be fixed by #64587
Assignees
Labels
awaiting review Pull request awaiting review comp:ops OPs related issues TF 2.15 For issues related to 2.15.x type:bug Bug

Comments

@drewshark
Copy link

Issue type

Bug

Have you reproduced the bug with TensorFlow Nightly?

Yes

Source

source

TensorFlow version

2.15.0

Custom code

Yes

OS platform and distribution

No response

Mobile device

No response

Python version

No response

Bazel version

No response

GCC/compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current behavior?

Hi, I want to report two issues: both tf.raw_ops.ApproximateEqual and tf.raw_ops.Erfinv can only support float32, float64, and double and fail on other datatype with the error message NotFoundError: Could not find device for node: {{node xxx}} = xxx[T=DT_XXX]

These behaviors are inconsistent with related documentations of these two APIs:

https://www.tensorflow.org/api_docs/python/tf/raw_ops/ApproximateEqual
https://www.tensorflow.org/api_docs/python/tf/raw_ops/Erfinv

Standalone code to reproduce the issue

import tensorflow as tf
import numpy as np
import warnings
warnings.filterwarnings("ignore")
dtype_list = [
    'bfloat16', 'bool', 'complex128', 'complex64',
    'double', 'float16', 'float32',
    'float64', 'half', 'int16', 'int32', 'int64', 'int8',
    'uint16', 'uint32', 'uint64', 'uint8'
]
for dtype in dtype_list:
    x = tf.constant(np.random.randint(-50, 50, ()), dtype=dtype)
    y = tf.constant(np.random.randint(-50, 50, ()), dtype=dtype)
    try:
        out = tf.raw_ops.ApproximateEqual(x=x,y=y)
        print(f"ApproximateEqual Success on dtype: {dtype}")
    except:
        print(f"ApproximateEqual Fail on dtype: {dtype}")

import tensorflow as tf
import numpy as np
import warnings
warnings.filterwarnings("ignore")
dtype_list = [
    'bfloat16', 'bool', 'complex128', 'complex64',
    'double', 'float16', 'float32',
    'float64', 'half', 'int16', 'int32', 'int64', 'int8',
    'uint16', 'uint32', 'uint64', 'uint8'
]
for dtype in dtype_list:
    x = tf.constant(np.random.randint(-50, 50, ()), dtype=dtype)
    try:
        out = tf.raw_ops.Erfinv(x=x)
        print(f"Erfinv Success on dtype: {dtype}")
    except:
        print(f"Erfinv Fail on dtype: {dtype}")

Relevant log output

ApproximateEqual Fail on dtype: bfloat16
ApproximateEqual Fail on dtype: bool
ApproximateEqual Fail on dtype: complex128
ApproximateEqual Fail on dtype: complex64
ApproximateEqual Success on dtype: double
ApproximateEqual Fail on dtype: float16
ApproximateEqual Success on dtype: float32
ApproximateEqual Success on dtype: float64
ApproximateEqual Fail on dtype: half
ApproximateEqual Fail on dtype: int16
ApproximateEqual Fail on dtype: int32
ApproximateEqual Fail on dtype: int64
ApproximateEqual Fail on dtype: int8
ApproximateEqual Fail on dtype: uint16
ApproximateEqual Fail on dtype: uint32
ApproximateEqual Fail on dtype: uint64
ApproximateEqual Fail on dtype: uint8

Erfinv Fail on dtype: bfloat16
Erfinv Fail on dtype: bool
Erfinv Fail on dtype: complex128
Erfinv Fail on dtype: complex64
Erfinv Success on dtype: double
Erfinv Fail on dtype: float16
Erfinv Success on dtype: float32
Erfinv Success on dtype: float64
Erfinv Fail on dtype: half
Erfinv Fail on dtype: int16
Erfinv Fail on dtype: int32
Erfinv Fail on dtype: int64
Erfinv Fail on dtype: int8
Erfinv Fail on dtype: uint16
Erfinv Fail on dtype: uint32
Erfinv Fail on dtype: uint64
Erfinv Fail on dtype: uint8
@google-ml-butler google-ml-butler bot added the type:bug Bug label Mar 22, 2024
@sushreebarsa sushreebarsa added comp:ops OPs related issues TF 2.15 For issues related to 2.15.x labels Mar 27, 2024
@sushreebarsa
Copy link
Contributor

@SuryanarayanaY I was able to replicate the issue reported here in TF v2.15 and nightly. Thank you!

@SuryanarayanaY
Copy link
Collaborator

Hi @drewshark ,

I can see the Op ApproximateEqual is registered for number types but kernel not built for same. Will propose a probable fix for same.

.Attr("T: numbertype")

@SuryanarayanaY
Copy link
Collaborator

The Op Erfinv is registered for bfloat16, half, float32, float64 but fails with half and bfloat16. Other int and complex types not supported hence it will fail.

For Erfinv Op half and bfloat16 needs to be added of not working. Thanks!

@SuryanarayanaY
Copy link
Collaborator

I think the fix for Erfinv should be done at Eigen repo.

@SuryanarayanaY SuryanarayanaY added the awaiting review Pull request awaiting review label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review Pull request awaiting review comp:ops OPs related issues TF 2.15 For issues related to 2.15.x type:bug Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants