lm1b/utils/model.py
def create_sharded_weights( shape, num_shards, name="W", concat_dim=0 ):
    """
    todo: see if tf's built in variable sharding can replace
    :param shape:
    :param num_shards:
    :param name:
    :param concat_dim:
    :return:
    """

    weights = []
    for i in range( 0, num_shards ):
        cur_w = tf.get_variable( name + "_" + str( i ), shape=shape,
                                 initializer=tf.random_normal_initializer,
                                 dtype=tf.float32 )
        weights.append( cur_w )
    w = tf.concat( weights, concat_dim )
    return w

    todo: see if tf's built in variable sharding can replace
    :param shape:
    :param num_shards:
    :param name:
    :param concat_dim:
    :return:
    
see if tf's built in variable sharding can replace
see if tf ' s built in variable sharding can replace
def create_sharded_weights( shape, num_shards, name="W", concat_dim=0 ):
    weights = []
    for i in range( 0, num_shards ):
        cur_w = tf.get_variable( name + "_" + str( i ), shape=shape,
                                 initializer=tf.random_normal_initializer,
                                 dtype=tf.float32 )
        weights.append( cur_w )
    w = tf.concat( weights, concat_dim )
    return w
def create_sharded_weights ( shape , num_shards , name = "W" , concat_dim = 0 ) : weights = [ ] for i in range ( 0 , num_shards ) : cur_w = tf . get_variable ( name + "_" + str ( i ) , shape = shape , initializer = tf . random_normal_initializer , dtype = tf . float32 ) weights . append ( cur_w ) w = tf . concat ( weights , concat_dim ) return w
todo: see if tf's built in variable sharding can replace
todo : see if tf ' s built in variable sharding can replace
"""
    todo: see if tf's built in variable sharding can replace
    :param shape:
    :param num_shards:
    :param name:
    :param concat_dim:
    :return:
    """
None
shape
None
num_shards
None
name
None
concat_dim
None