在运行tensorflow.python.ops.gen_array_ops.quantize_and_dequantize_v4时检查失败,

yduiuuwa  于 2个月前  发布在  Python
关注(0)|答案(3)|浏览(37)

问题类型

Bug

你是否在TF nightly版本中复现了该bug?

是的

问题来源

source

Tensorflow版本

2.11.0

自定义代码

是的

OS平台和发行版

Ubuntu 22.04

移动设备

  • 无响应*

Python版本

3.9

Bazel版本

  • 无响应*

GCC/编译器版本

  • 无响应*

CUDA/cuDNN版本

  • 无响应*

GPU型号和内存大小

  • 无响应*

当前行为?

Check failure when running .python.ops.gen_array_ops.quantize_and_dequantize_v4

独立代码以重现问题

import tensorflow as tf
import os
import numpy as np
from tensorflow.python.ops import gen_array_ops
try:
  arg_0_tensor = tf.saturate_cast(tf.random.uniform([2, 3, 4], minval=0, maxval=2, dtype=tf.int64), dtype=tf.uint64)
  arg_0 = tf.identity(arg_0_tensor)
  input_min = -1
  input_max = -1
  signed_input = False
  num_bits = 7
  range_given = True
  round_mode = "nan"
  narrow_range = True
  axis = -2
  out = gen_array_ops.quantize_and_dequantize_v4(arg_0,input_min=input_min,input_max=input_max,signed_input=signed_input,num_bits=num_bits,range_given=range_given,round_mode=round_mode,narrow_range=narrow_range,axis=axis,)
except Exception as e:
  print("Error:"+str(e))

相关日志输出

023-01-06 09:14:31.245795: F ./tensorflow/python/eager/pywrap_tensor_conversion.h:58] Check failed: !PyErr_Occurred() 
Aborted
</details>
eaf3rand

eaf3rand1#

你好@nimashiri!

感谢你分享了关于gen_array_ops.quantize_and_dequantize_v4在2.11版本和Ubuntu上的使用方法。我在使用TF 2.11、Ubuntu 18和Cuda 11.2 + CudNN 8.1时遇到了以下错误:

Error:Value for attr 'T' of uint64 is not in the list of allowed values: bfloat16, half, float, double
	; NodeDef: {{node QuantizeAndDequantizeV4}}; Op<name=QuantizeAndDequantizeV4; signature=input:T, input_min:T, input_max:T -> output:T; attr=signed_input:bool,default=true; attr=num_bits:int,default=8; attr=range_given:bool,default=false; attr=T:type,allowed=[DT_BFLOAT16, DT_HALF, DT_FLOAT, DT_DOUBLE]; attr=round_mode:string,default="HALF_TO_EVEN",allowed=["HALF_TO_EVEN", "HALF_UP"]; attr=narrow_range:bool,default=false; attr=axis:int,default=-1> [Op:QuantizeAndDequantizeV4]

你能在Cuda 11.2、CudNN 8.1和TF 2.11的情况下检查一下吗?或者在Cuda 11.7、CudNN 8.2和TF-nightly的情况下也检查一下,然后告诉我们结果。如果可以的话,请也分享一下操作系统和CUDA的详细信息(Ubuntu Arm 64或X86_64,Cuda 11.2或11.7)。

非常感谢!

dfuffjeb

dfuffjeb2#

从Colab:

Error:Value for attr 'T' of uint64 is not in the list of allowed values: bfloat16, half, float, double
	; NodeDef: {{node QuantizeAndDequantizeV4}}; Op<name=QuantizeAndDequantizeV4; signature=input:T, input_min:T, input_max:T -> output:T; attr=signed_input:bool,default=true; attr=num_bits:int,default=8; attr=range_given:bool,default=false; attr=T:type,allowed=[DT_BFLOAT16, DT_HALF, DT_FLOAT, DT_DOUBLE]; attr=round_mode:string,default="HALF_TO_EVEN",allowed=["HALF_TO_EVEN", "HALF_UP"]; attr=narrow_range:bool,default=false; attr=axis:int,default=-1> [Op:QuantizeAndDequantizeV4]

Colab paid products - Cancel contracts here

从终端:

2023-01-09 10:11:50.975850: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-01-09 10:11:51.507938: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/home/nimashiri/anaconda3/envs/cuda11.2/lib/
2023-01-09 10:11:51.508097: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/home/nimashiri/anaconda3/envs/cuda11.2/lib/
2023-01-09 10:11:51.508104: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
2023-01-09 10:11:51.997861: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2023-01-09 10:11:52.023990: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2023-01-09 10:11:52.024113: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2023-01-09 10:11:52.024507: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-01-09 10:11:52.025015: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2023-01-09 10:11:52.025121: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2023-01-09 10:11:52.025214: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2023-01-09 10:11:52.639793: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2023-01-09 10:11:52.639941: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2023-01-09 10:11:52.640069: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2023-01-09 10:11:52.640201: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1613] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 4125 MB memory:  -> device: 0, name: NVIDIA GeForce GTX 1660 Ti, pci bus id: 0000:01:00.0, compute capability: 7.5
Error:can't convert negative int to unsigned

简单地通过VSCODE运行位于上述代码所在位置的脚本:

2023-01-09 10:13:02.292944: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-01-09 10:13:02.852646: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory
2023-01-09 10:13:02.852689: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory
2023-01-09 10:13:02.852696: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
2023-01-09 10:13:03.378474: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2023-01-09 10:13:03.415108: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudnn.so.8'; dlerror: libcudnn.so.8: cannot open shared object file: No such file or directory
2023-01-09 10:13:03.415132: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1934] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2023-01-09 10:13:03.415379: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
Error:can't convert negative int to unsigned

通过subprocess.run()运行:

2023-01-09 10:15:16.155685: F ./tensorflow/python/eager/pywrap_tensor_conversion.h:58] Check failed: !PyErr_Occurred() 
Aborted

相关问题