intel / intel-extension-for-tensorflow

Intel® Extension for TensorFlow*
Other
317 stars 40 forks source link

Error while trying to use tf.tile for float32 tensor #39

Closed aistrych closed 1 year ago

aistrych commented 1 year ago

Used packages:

intel-extension-for-tensorflow==1.2.0 tensorflow==2.12.0 keras==2.12.0

example code:

import tensorflow as tf
import numpy as np

a = tf.Variable(np.random.rand(1, 4, 2))
test = tf.tile(a, [1, 1, 3])

received errors:

  File "/home/user/test/venv/lib/python3.10/site-packages/tensorflow/python/ops/gen_array_ops.py", line 11765, in tile
    return tile_eager_fallback(
  File "/home/user/test/venv/lib/python3.10/site-packages/tensorflow/python/ops/gen_array_ops.py", line 11811, in tile_eager_fallback
    _result = _execute.execute(b"Tile", 1, inputs=_inputs_flat, attrs=_attrs,
  File "/home/user/test/venv/lib/python3.10/site-packages/tensorflow/python/eager/execute.py", line 52, in quick_execute
    tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.InternalError: {{function_node __wrapped__Tile_device_/job:localhost/replica:0/task:0/device:XPU:0}} Tile op executes failed with error message: Native API failed. Native API returns: -50 (PI_ERROR_INVALID_ARG_VALUE) -50 (PI_ERROR_INVALID_ARG_VALUE) [Op:Tile]

Replacing float32 with int32 works fine. Also running it on CPU works fine.

srinarayan-srikanthan commented 1 year ago

@Astrych Are you looking to use float32? I am able to run the sample code by explicitly setting float32.

aistrych commented 1 year ago

@srinarayan-srikanthan Do you mean

a = tf.Variable(np.random.rand(1, 4, 2), dtype=tf.float32)

? I was sure I've checked this already but maybe not. I will recheck it later today.

aistrych commented 1 year ago

OK, it works with added dtype=tf.float32. Thanks!