Commit 0145501a authored by Sabry Razick's avatar Sabry Razick
Browse files

Matrics test

parent 4a9aa5fa
#!/usr/bin/env python3
import numpy as np
import tensorflow as tf
limit=25000
import tensorflow as tf
tf.debugging.set_log_device_placement(True)
try:
# Place tensors on the GPU
with tf.device('/GPU:0'):
b = tf.random.uniform(shape=[limit,limit], minval=5, maxval=10, dtype=tf.int32)
a = tf.random.uniform(shape=[limit,limit], minval=5, maxval=10, dtype=tf.int32)
c = tf.matmul(a, b)
c_np = c.numpy()
print(c_np.shape)
except RuntimeError as e:
print(e)
#!/usr/bin/env python3
import numpy as np
import tensorflow as tf
limit=50
type=tf.float16
b = tf.random.uniform(shape=[limit,limit], minval=5, maxval=10, dtype=tf.float16)
a = tf.random.uniform(shape=[limit,limit], minval=5, maxval=10, dtype=tf.float16)
c = tf.matmul(a, b)
c_np = c.numpy()
print(c_np.shape)
#>>> x=tf.constant([1.0,2])
#>>> x.dtype
#tf.float32
#!/usr/bin/env python3
import numpy as np
import tensorflow as tf
limit=50
type=tf.float16
b = tf.random.uniform(shape=[limit,limit], minval=5, maxval=10, dtype=tf.float16)
a = tf.random.uniform(shape=[limit,limit], minval=5, maxval=10, dtype=tf.float16)
c = tf.matmul(a, b)
b_np = b.numpy()
#>>> x=tf.constant([1.0,2])
#>>> x.dtype
#tf.float32
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment