(initial_value: np.ndarray, *args, **kwargs)
return var
Create tf.Variable with large initial value without bloating the tf graph.
Create tf.Variable with large initial value without bloating the tf graph.
Create tf . Variable with large initial value without bloating the tf graph .
def create_var_with_large_initial_value(initial_value: np.ndarray, *args, **kwargs):
    """Create tf.Variable with large initial value without bloating the tf graph."""
    assert_tf_initialized()
    assert isinstance(initial_value, np.ndarray)
    zeros = tf.zeros(initial_value.shape, initial_value.dtype)
    var = tf.Variable(zeros, *args, **kwargs)
    set_vars({var: initial_value})
    return var
def create_var_with_large_initial_value ( initial_value : np . ndarray , * args , * * kwargs ) : assert_tf_initialized ( ) assert isinstance ( initial_value , np . ndarray ) zeros = tf . zeros ( initial_value . shape , initial_value . dtype ) var = tf . Variable ( zeros , * args , * * kwargs ) set_vars ( { var : initial_value } ) return var