Error when creating random tensor in TensorFlow-Metal

Dear developers,

I am encountering a bug when using TensorFlow-Metal.

When I do the following:

random_1 = tf.random.Generator.from_seed(42)
random_1 = random_1.normal(shape=(3,2))
random_1

I got the following error: NotFoundError: No registered 'RngReadAndSkip' OpKernel for 'GPU' devices compatible with node {{node RngReadAndSkip}} . Registered: device='CPU' [Op:RngReadAndSkip]

But it works fine when creating random tensors with cpu like the following:

with tf.device('/cpu:0'):
    random_1 = tf.random.Generator.from_seed(42)
    random_1 = random_1.normal(shape=(3,2))
 random_1

Hi @Leozz99

Thanks for reporting the issue! This is indeed caused by a missing registration of the RngReadAndSkip op which we are in the process of implementing. I will update here once it is added to tensorflow-metal.

RngReadAndSkip is registered on the GPU in tensorflow-metal==0.5.1 which should fix this issue.

Error when creating random tensor in TensorFlow-Metal
 
 
Q