intel / intel/intel-extension-for-tensorflow

Low accuracy on Arc A380

Open
#5 11 comments 2 reactions 1 assignee Claimed by @Wanzizhu View on GitHub
bug
Dominant language
C++
Stars
353
Forks
45
PR merge metrics
No merged PRs in 30d

Description

It seems like XPU calculation accuracy deteriorates in 4th-5th digit after the dot on common math operation.
Here is the sample code:

```
a = tf.random.normal(shape=[10000, 10000], dtype=tf.float32)
b = tf.random.normal(shape=[10000, 10000], dtype=tf.float32)

@tf.function
def run(a, b):
x1 = tf.nn.relu(a)
y1 = tf.nn.relu(b)
x2 = tf.math.square(x1)
y2 = tf.math.square(y1)
x3 = tf.math.scalar_mul(33e-5, x2)
y3 = tf.math.scalar_mul(33e-5, y2)
return tf.tensordot(x3, y3, 2)

with tf.device("/XPU:0"):
print(f"XPU Result: {run(a, b)}")

with tf.device("/CPU:0"):
print(f"CPU Result: {run(a, b)}")
```

Which yields the following results:

```
XPU Result: 2.721888542175293
CPU Result: 2.5815889835357666
```

System:
Asrock A380
Ubuntu 22.04 (kernel 5.17.0-1019-oem)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.