neulab/docprompting-conala huggingface dataset:
tf.keras.initializers.HeNormal He normal initializer. Inherits From: VarianceScaling, Initializer  View aliases  Main aliases 
tf.initializers.HeNormal, tf.initializers.he_normal, tf.keras.initializers.he_normal  
tf.keras.initializers.HeNormal(
    seed=None
)
 Also available via the shortcut function tf.keras.initializers.he_normal. It draws samples from a truncated normal distribution centered on 0 with stddev = sqrt(2 / fan_in) where fan_in is the number of input units in the weight tensor. Examples: 
# Standalone usage:
initializer = tf.keras.initializers.HeNormal()
values = initializer(shape=(2, 2))
 
# Usage in a Keras layer:
initializer = tf.keras.initializers.HeNormal()
layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

 


 Arguments
  seed   A Python integer. An initializer created with a given seed will always produce the same random tensor for a given shape and dtype.    References: He et al., 2015 (pdf) Methods from_config View source 
@classmethod
from_config(
    config
)
 Instantiates an initializer from a configuration dictionary. Example: initializer = RandomUniform(-1, 1)
config = initializer.get_config()
initializer = RandomUniform.from_config(config)

 


 Args
  config   A Python dictionary. It will typically be the output of get_config.   
 


 Returns   An Initializer instance.  
 get_config View source 
get_config()
 Returns the configuration of the initializer as a JSON-serializable dict.
 


 Returns   A JSON-serializable Python dict.  
 __call__ View source 
__call__(
    shape, dtype=None, **kwargs
)
 Returns a tensor object initialized as specified by the initializer.
 


 Args
  shape   Shape of the tensor.  
  dtype   Optional dtype of the tensor. Only floating point types are supported. If not specified, tf.keras.backend.floatx() is used, which default to float32 unless you configured it otherwise (via tf.keras.backend.set_floatx(float_dtype))  
  **kwargs   Additional keyword arguments.
tf.keras.initializers.HeUniform He uniform variance scaling initializer. Inherits From: VarianceScaling, Initializer  View aliases  Main aliases 
tf.initializers.HeUniform, tf.initializers.he_uniform, tf.keras.initializers.he_uniform  
tf.keras.initializers.HeUniform(
    seed=None
)
 Also available via the shortcut function tf.keras.initializers.he_uniform. Draws samples from a uniform distribution within [-limit, limit], where limit = sqrt(6 / fan_in) (fan_in is the number of input units in the weight tensor). Examples: 
# Standalone usage:
initializer = tf.keras.initializers.HeUniform()
values = initializer(shape=(2, 2))
 
# Usage in a Keras layer:
initializer = tf.keras.initializers.HeUniform()
layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

 


 Arguments
  seed   A Python integer. An initializer created with a given seed will always produce the same random tensor for a given shape and dtype.    References: He et al., 2015 (pdf) Methods from_config View source 
@classmethod
from_config(
    config
)
 Instantiates an initializer from a configuration dictionary. Example: initializer = RandomUniform(-1, 1)
config = initializer.get_config()
initializer = RandomUniform.from_config(config)

 


 Args
  config   A Python dictionary. It will typically be the output of get_config.   
 


 Returns   An Initializer instance.  
 get_config View source 
get_config()
 Returns the configuration of the initializer as a JSON-serializable dict.
 


 Returns   A JSON-serializable Python dict.  
 __call__ View source 
__call__(
    shape, dtype=None, **kwargs
)
 Returns a tensor object initialized as specified by the initializer.
 


 Args
  shape   Shape of the tensor.  
  dtype   Optional dtype of the tensor. Only floating point types are supported. If not specified, tf.keras.backend.floatx() is used, which default to float32 unless you configured it otherwise (via tf.keras.backend.set_floatx(float_dtype))  
  **kwargs   Additional keyword arguments.
tf.keras.initializers.Identity Initializer that generates the identity matrix. Inherits From: Initializer  View aliases  Main aliases 
tf.initializers.Identity, tf.initializers.identity, tf.keras.initializers.identity  
tf.keras.initializers.Identity(
    gain=1.0
)
 Also available via the shortcut function tf.keras.initializers.identity. Only usable for generating 2D matrices. Examples: 
# Standalone usage:
initializer = tf.keras.initializers.Identity()
values = initializer(shape=(2, 2))
 
# Usage in a Keras layer:
initializer = tf.keras.initializers.Identity()
layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

 


 Args
  gain   Multiplicative factor to apply to the identity matrix.    Methods from_config View source 
@classmethod
from_config(
    config
)
 Instantiates an initializer from a configuration dictionary. Example: initializer = RandomUniform(-1, 1)
config = initializer.get_config()
initializer = RandomUniform.from_config(config)

 


 Args
  config   A Python dictionary. It will typically be the output of get_config.   
 


 Returns   An Initializer instance.  
 get_config View source 
get_config()
 Returns the configuration of the initializer as a JSON-serializable dict.
 


 Returns   A JSON-serializable Python dict.  
 __call__ View source 
__call__(
    shape, dtype=None, **kwargs
)
 Returns a tensor object initialized to a 2D identity matrix.
 


 Args
  shape   Shape of the tensor. It should have exactly rank 2.  
  dtype   Optional dtype of the tensor. Only floating point types are supported. If not specified, tf.keras.backend.floatx() is used, which default to float32 unless you configured it otherwise (via tf.keras.backend.set_floatx(float_dtype))  
  **kwargs   Additional keyword arguments.
tf.keras.initializers.Initializer     View source on GitHub    Initializer base class: all Keras initializers inherit from this class.  View aliases  Main aliases 
tf.initializers.Initializer Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.initializers.Initializer  Initializers should implement a __call__ method with the following signature: def __call__(self, shape, dtype=None, **kwargs):
  # returns a tensor of shape `shape` and dtype `dtype`
  # containing values drawn from a distribution of your choice.
 Optionally, you an also implement the method get_config and the class method from_config in order to support serialization -- just like with any Keras object. Here's a simple example: a random normal initializer. import tensorflow as tf

class ExampleRandomNormal(tf.keras.initializers.Initializer):

  def __init__(self, mean, stddev):
    self.mean = mean
    self.stddev = stddev

  def __call__(self, shape, dtype=None, **kwargs):
    return tf.random.normal(
        shape, mean=self.mean, stddev=self.stddev, dtype=dtype)

  def get_config(self):  # To support serialization
    return {"mean": self.mean, "stddev": self.stddev}
 Note that we don't have to implement from_config in the example above since the constructor arguments of the class the keys in the config returned by get_config are the same. In this case, the default from_config works fine. Methods from_config View source 
@classmethod
from_config(
    config
)
 Instantiates an initializer from a configuration dictionary. Example: initializer = RandomUniform(-1, 1)
config = initializer.get_config()
initializer = RandomUniform.from_config(config)

 


 Args
  config   A Python dictionary, the output of get_config.   
 


 Returns   A tf.keras.initializers.Initializer instance.  
 get_config View source 
get_config()
 Returns the configuration of the initializer as a JSON-serializable dict.
 


 Returns   A JSON-serializable Python dict.  
 __call__ View source 
__call__(
    shape, dtype=None, **kwargs
)
 Returns a tensor object initialized as specified by the initializer.
 


 Args
  shape   Shape of the tensor.  
  dtype   Optional dtype of the tensor.  
  **kwargs   Additional keyword arguments.
tf.keras.initializers.LecunNormal Lecun normal initializer. Inherits From: VarianceScaling, Initializer  View aliases  Main aliases 
tf.initializers.LecunNormal, tf.initializers.lecun_normal, tf.keras.initializers.lecun_normal  
tf.keras.initializers.LecunNormal(
    seed=None
)
 Also available via the shortcut function tf.keras.initializers.lecun_normal. Initializers allow you to pre-specify an initialization strategy, encoded in the Initializer object, without knowing the shape and dtype of the variable being initialized. Draws samples from a truncated normal distribution centered on 0 with stddev = sqrt(1 / fan_in) where fan_in is the number of input units in the weight tensor. Examples: 
# Standalone usage:
initializer = tf.keras.initializers.LecunNormal()
values = initializer(shape=(2, 2))
 
# Usage in a Keras layer:
initializer = tf.keras.initializers.LecunNormal()
layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

 


 Arguments
  seed   A Python integer. Used to seed the random generator.    References:  Self-Normalizing Neural Networks, Klambauer et al., 2017 (pdf) Efficient Backprop, Lecun et al., 1998
  Methods from_config View source 
@classmethod
from_config(
    config
)
 Instantiates an initializer from a configuration dictionary. Example: initializer = RandomUniform(-1, 1)
config = initializer.get_config()
initializer = RandomUniform.from_config(config)

 


 Args
  config   A Python dictionary. It will typically be the output of get_config.   
 


 Returns   An Initializer instance.  
 get_config View source 
get_config()
 Returns the configuration of the initializer as a JSON-serializable dict.
 


 Returns   A JSON-serializable Python dict.  
 __call__ View source 
__call__(
    shape, dtype=None, **kwargs
)
 Returns a tensor object initialized as specified by the initializer.
 


 Args
  shape   Shape of the tensor.  
  dtype   Optional dtype of the tensor. Only floating point types are supported. If not specified, tf.keras.backend.floatx() is used, which default to float32 unless you configured it otherwise (via tf.keras.backend.set_floatx(float_dtype))  
  **kwargs   Additional keyword arguments.
tf.keras.initializers.LecunUniform Lecun uniform initializer. Inherits From: VarianceScaling, Initializer  View aliases  Main aliases 
tf.initializers.LecunUniform, tf.initializers.lecun_uniform, tf.keras.initializers.lecun_uniform  
tf.keras.initializers.LecunUniform(
    seed=None
)
 Also available via the shortcut function tf.keras.initializers.lecun_uniform. Draws samples from a uniform distribution within [-limit, limit], where limit = sqrt(3 / fan_in) (fan_in is the number of input units in the weight tensor). Examples: 
# Standalone usage:
initializer = tf.keras.initializers.LecunUniform()
values = initializer(shape=(2, 2))
 
# Usage in a Keras layer:
initializer = tf.keras.initializers.LecunUniform()
layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

 


 Arguments
  seed   A Python integer. An initializer created with a given seed will always produce the same random tensor for a given shape and dtype.    References:  Self-Normalizing Neural Networks, Klambauer et al., 2017 (pdf) Efficient Backprop, Lecun et al., 1998
  Methods from_config View source 
@classmethod
from_config(
    config
)
 Instantiates an initializer from a configuration dictionary. Example: initializer = RandomUniform(-1, 1)
config = initializer.get_config()
initializer = RandomUniform.from_config(config)

 


 Args
  config   A Python dictionary. It will typically be the output of get_config.   
 


 Returns   An Initializer instance.  
 get_config View source 
get_config()
 Returns the configuration of the initializer as a JSON-serializable dict.
 


 Returns   A JSON-serializable Python dict.  
 __call__ View source 
__call__(
    shape, dtype=None, **kwargs
)
 Returns a tensor object initialized as specified by the initializer.
 


 Args
  shape   Shape of the tensor.  
  dtype   Optional dtype of the tensor. Only floating point types are supported. If not specified, tf.keras.backend.floatx() is used, which default to float32 unless you configured it otherwise (via tf.keras.backend.set_floatx(float_dtype))  
  **kwargs   Additional keyword arguments.
tf.keras.initializers.Ones Initializer that generates tensors initialized to 1. Inherits From: ones_initializer, Initializer  View aliases  Main aliases 
tf.initializers.Ones, tf.initializers.ones, tf.keras.initializers.ones  Also available via the shortcut function tf.keras.initializers.ones. Examples: 
# Standalone usage:
initializer = tf.keras.initializers.Ones()
values = initializer(shape=(2, 2))
 
# Usage in a Keras layer:
initializer = tf.keras.initializers.Ones()
layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)
 Methods from_config View source 
@classmethod
from_config(
    config
)
 Instantiates an initializer from a configuration dictionary. Example: initializer = RandomUniform(-1, 1)
config = initializer.get_config()
initializer = RandomUniform.from_config(config)

 


 Args
  config   A Python dictionary. It will typically be the output of get_config.   
 


 Returns   An Initializer instance.  
 get_config View source 
get_config()
 Returns the configuration of the initializer as a JSON-serializable dict.
 


 Returns   A JSON-serializable Python dict.  
 __call__ View source 
__call__(
    shape, dtype=None, **kwargs
)
 Returns a tensor object initialized as specified by the initializer.
 


 Args
  shape   Shape of the tensor.  
  dtype   Optional dtype of the tensor. Only numeric or boolean dtypes are supported. If not specified, tf.keras.backend.floatx() is used, which default to float32 unless you configured it otherwise (via tf.keras.backend.set_floatx(float_dtype)).  
  **kwargs   Additional keyword arguments.
tf.keras.initializers.Orthogonal Initializer that generates an orthogonal matrix. Inherits From: Initializer  View aliases  Main aliases 
tf.initializers.Orthogonal, tf.initializers.orthogonal, tf.keras.initializers.orthogonal  
tf.keras.initializers.Orthogonal(
    gain=1.0, seed=None
)
 Also available via the shortcut function tf.keras.initializers.orthogonal. If the shape of the tensor to initialize is two-dimensional, it is initialized with an orthogonal matrix obtained from the QR decomposition of a matrix of random numbers drawn from a normal distribution. If the matrix has fewer rows than columns then the output will have orthogonal rows. Otherwise, the output will have orthogonal columns. If the shape of the tensor to initialize is more than two-dimensional, a matrix of shape (shape[0] * ... * shape[n - 2], shape[n - 1]) is initialized, where n is the length of the shape vector. The matrix is subsequently reshaped to give a tensor of the desired shape. Examples: 
# Standalone usage:
initializer = tf.keras.initializers.Orthogonal()
values = initializer(shape=(2, 2))
 
# Usage in a Keras layer:
initializer = tf.keras.initializers.Orthogonal()
layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

 


 Args
  gain   multiplicative factor to apply to the orthogonal matrix  
  seed   A Python integer. An initializer created with a given seed will always produce the same random tensor for a given shape and dtype.    References: Saxe et al., 2014 (pdf) Methods from_config View source 
@classmethod
from_config(
    config
)
 Instantiates an initializer from a configuration dictionary. Example: initializer = RandomUniform(-1, 1)
config = initializer.get_config()
initializer = RandomUniform.from_config(config)

 


 Args
  config   A Python dictionary. It will typically be the output of get_config.   
 


 Returns   An Initializer instance.  
 get_config View source 
get_config()
 Returns the configuration of the initializer as a JSON-serializable dict.
 


 Returns   A JSON-serializable Python dict.  
 __call__ View source 
__call__(
    shape, dtype=None, **kwargs
)
 Returns a tensor object initialized to an orthogonal matrix.
 


 Args
  shape   Shape of the tensor.  
  dtype   Optional dtype of the tensor. Only floating point types are supported. If not specified, tf.keras.backend.floatx() is used, which default to float32 unless you configured it otherwise (via tf.keras.backend.set_floatx(float_dtype))  
  **kwargs   Additional keyword arguments.
tf.keras.initializers.RandomNormal     View source on GitHub    Initializer that generates tensors with a normal distribution. Inherits From: random_normal_initializer, Initializer  View aliases  Main aliases 
tf.initializers.RandomNormal, tf.initializers.random_normal, tf.keras.initializers.random_normal  
tf.keras.initializers.RandomNormal(
    mean=0.0, stddev=0.05, seed=None
)
 Also available via the shortcut function tf.keras.initializers.random_normal. Examples: 
# Standalone usage:
initializer = tf.keras.initializers.RandomNormal(mean=0., stddev=1.)
values = initializer(shape=(2, 2))
 
# Usage in a Keras layer:
initializer = tf.keras.initializers.RandomNormal(mean=0., stddev=1.)
layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

 


 Args
  mean   a python scalar or a scalar tensor. Mean of the random values to generate.  
  stddev   a python scalar or a scalar tensor. Standard deviation of the random values to generate.  
  seed   A Python integer. An initializer created with a given seed will always produce the same random tensor for a given shape and dtype.    Methods from_config View source 
@classmethod
from_config(
    config
)
 Instantiates an initializer from a configuration dictionary. Example: initializer = RandomUniform(-1, 1)
config = initializer.get_config()
initializer = RandomUniform.from_config(config)

 


 Args
  config   A Python dictionary. It will typically be the output of get_config.   
 


 Returns   An Initializer instance.  
 get_config View source 
get_config()
 Returns the configuration of the initializer as a JSON-serializable dict.
 


 Returns   A JSON-serializable Python dict.  
 __call__ View source 
__call__(
    shape, dtype=None, **kwargs
)
 Returns a tensor object initialized to random normal values.
 


 Args
  shape   Shape of the tensor.  
  dtype   Optional dtype of the tensor. Only floating point types are supported. If not specified, tf.keras.backend.floatx() is used, which default to float32 unless you configured it otherwise (via tf.keras.backend.set_floatx(float_dtype))  
  **kwargs   Additional keyword arguments.
tf.keras.initializers.RandomUniform     View source on GitHub    Initializer that generates tensors with a uniform distribution. Inherits From: random_uniform_initializer, Initializer  View aliases  Main aliases 
tf.initializers.RandomUniform, tf.initializers.random_uniform, tf.keras.initializers.random_uniform  
tf.keras.initializers.RandomUniform(
    minval=-0.05, maxval=0.05, seed=None
)
 Also available via the shortcut function tf.keras.initializers.random_uniform. Examples: 
# Standalone usage:
initializer = tf.keras.initializers.RandomUniform(minval=0., maxval=1.)
values = initializer(shape=(2, 2))
 
# Usage in a Keras layer:
initializer = tf.keras.initializers.RandomUniform(minval=0., maxval=1.)
layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

 


 Args
  minval   A python scalar or a scalar tensor. Lower bound of the range of random values to generate (inclusive).  
  maxval   A python scalar or a scalar tensor. Upper bound of the range of random values to generate (exclusive).  
  seed   A Python integer. An initializer created with a given seed will always produce the same random tensor for a given shape and dtype.    Methods from_config View source 
@classmethod
from_config(
    config
)
 Instantiates an initializer from a configuration dictionary. Example: initializer = RandomUniform(-1, 1)
config = initializer.get_config()
initializer = RandomUniform.from_config(config)

 


 Args
  config   A Python dictionary. It will typically be the output of get_config.   
 


 Returns   An Initializer instance.  
 get_config View source 
get_config()
 Returns the configuration of the initializer as a JSON-serializable dict.
 


 Returns   A JSON-serializable Python dict.  
 __call__ View source 
__call__(
    shape, dtype=None, **kwargs
)
 Returns a tensor object initialized as specified by the initializer.
 


 Args
  shape   Shape of the tensor.  
  dtype   Optional dtype of the tensor. Only floating point and integer types are supported. If not specified, tf.keras.backend.floatx() is used, which default to float32 unless you configured it otherwise (via tf.keras.backend.set_floatx(float_dtype)).  
  **kwargs   Additional keyword arguments.
tf.keras.initializers.serialize     View source on GitHub     View aliases  Main aliases 
tf.initializers.serialize Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.initializers.serialize  
tf.keras.initializers.serialize(
    initializer
)
tf.keras.initializers.TruncatedNormal     View source on GitHub    Initializer that generates a truncated normal distribution. Inherits From: Initializer  View aliases  Main aliases 
tf.initializers.TruncatedNormal, tf.initializers.truncated_normal, tf.keras.initializers.truncated_normal  
tf.keras.initializers.TruncatedNormal(
    mean=0.0, stddev=0.05, seed=None
)
 Also available via the shortcut function tf.keras.initializers.truncated_normal. The values generated are similar to values from a tf.keras.initializers.RandomNormal initializer except that values more than two standard deviations from the mean are discarded and re-drawn. Examples: 
# Standalone usage:
initializer = tf.keras.initializers.TruncatedNormal(mean=0., stddev=1.)
values = initializer(shape=(2, 2))
 
# Usage in a Keras layer:
initializer = tf.keras.initializers.TruncatedNormal(mean=0., stddev=1.)
layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

 


 Args
  mean   a python scalar or a scalar tensor. Mean of the random values to generate.  
  stddev   a python scalar or a scalar tensor. Standard deviation of the random values to generate.  
  seed   A Python integer. An initializer created with a given seed will always produce the same random tensor for a given shape and dtype.    Methods from_config View source 
@classmethod
from_config(
    config
)
 Instantiates an initializer from a configuration dictionary. Example: initializer = RandomUniform(-1, 1)
config = initializer.get_config()
initializer = RandomUniform.from_config(config)

 


 Args
  config   A Python dictionary. It will typically be the output of get_config.   
 


 Returns   An Initializer instance.  
 get_config View source 
get_config()
 Returns the configuration of the initializer as a JSON-serializable dict.
 


 Returns   A JSON-serializable Python dict.  
 __call__ View source 
__call__(
    shape, dtype=None, **kwargs
)
 Returns a tensor object initialized to random normal values (truncated).
 


 Args
  shape   Shape of the tensor.  
  dtype   Optional dtype of the tensor. Only floating point types are supported. If not specified, tf.keras.backend.floatx() is used, which default to float32 unless you configured it otherwise (via tf.keras.backend.set_floatx(float_dtype))  
  **kwargs   Additional keyword arguments.