def _make_masked_initializer(mask, initializer):
initializer = tf.keras.initializers.get(initializer)<EOL>def masked_initializer(shape, dtype=None, partition_info=None):<EOL><INDENT>if partition_info is None:<EOL><INDENT>x = initializer(shape, dtype)<EOL><DEDENT>else:<EOL><INDENT>x = initializer(shape, dtype, partition_info)<EOL><DEDENT>return tf.cast(mask, x.dtype) * x<EOL><DEDENT>return masked_initializer<EOL>
Returns a masked version of the given initializer.