Parameter Management

http://d2l.ai/chapter_deep-learning-computation/parameters.html

To align to mxnet,pytorch, tensorflow’s MyInit class should be:

class MyInit(tf.keras.initializers.Initializer):
def call(self, shape, dtype=None):
data=tf.random.uniform(shape,-10, 10, dtype=dtype)
factor=(tf.abs(data)>=5)
factor=tf.cast(factor,tf.float32)
return data*factor

tf

Hi @zhangjiekui, great catch! Would you like to be a contributor and post a PR for this at github?