For me it still occurs on Monterey 12.3.1 with newest versions:
tensorflow-metal==0.5.0
tensorflow-macos=2.9.2
For example this code will still always print the same values:
import tensorflow as tf
class CustomLayer(tf.keras.layers.Layer):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def call(self, x, training):
a = tf.random.uniform([])
tf.print(a)
return x
mnist = tf.keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train, x_test, y_train, y_test = x_train[:10], x_test[:10], y_train[:10], y_test[:10]
model = tf.keras.models.Sequential([ tf.keras.layers.Flatten(input_shape=(28, 28)),
tf.keras.layers.Dense(128, activation='relu'),
CustomLayer(),
tf.keras.layers.Dropout(0.2),
tf.keras.layers.Dense(10) ])
loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)
model.compile(optimizer='adam', loss=loss_fn, metrics=['accuracy'])
model.fit(x_train, y_train, epochs=1, batch_size=1)
Post
Replies
Boosts
Views
Activity
Unfortunately, it still does not work on Monterey 12.2.