def uniform_scaling(shape=None, factor=1.0, dtype=tf.float32, seed=None):
 if shape:
  input_size = 1.0
  for dim in shape[:(-1)]:
   input_size *= float(dim)
  max_val = (math.sqrt((3 / input_size)) * factor)
  return tf.random_ops.random_uniform(shape, (- max_val), max_val, dtype, seed=seed)
 else:
  return tf.uniform_unit_scaling_initializer(seed=seed, dtype=dtype)

def uniform_scaling ( shape = None , factor = 1.0 , dtype = tf . float32 , seed = None ) : if shape : input_size = 1.0 for dim in shape [ : ( - 1 ) ] : input_size *= float ( dim ) max_val = ( math . sqrt ( ( 3 / input_size ) ) * factor ) return tf . random_ops . random_uniform ( shape , ( - max_val ) , max_val , dtype , seed = seed ) else : return tf . uniform_unit_scaling_initializer ( seed = seed , dtype = dtype )
uniform scaling .