neulab/docprompting-conala huggingface dataset:
tf.compat.v1.train.warm_start Warm-starts a model using the given settings. 
tf.compat.v1.train.warm_start(
    ckpt_to_initialize_from, vars_to_warm_start='.*',
    var_name_to_vocab_info=None, var_name_to_prev_var_name=None
)
 If you are using a tf.estimator.Estimator, this will automatically be called during training.
 


 Args
  ckpt_to_initialize_from   [Required] A string specifying the directory with checkpoint file(s) or path to checkpoint from which to warm-start the model parameters.  
  vars_to_warm_start   [Optional] One of the following:  A regular expression (string) that captures which variables to warm-start (see tf.compat.v1.get_collection). This expression will only consider variables in the TRAINABLE_VARIABLES collection -- if you need to warm-start non_TRAINABLE vars (such as optimizer accumulators or batch norm statistics), please use the below option. A list of strings, each a regex scope provided to tf.compat.v1.get_collection with GLOBAL_VARIABLES (please see tf.compat.v1.get_collection). For backwards compatibility reasons, this is separate from the single-string argument type. A list of Variables to warm-start. If you do not have access to the Variable objects at the call site, please use the above option. 
None, in which case only TRAINABLE variables specified in var_name_to_vocab_info will be warm-started.  Defaults to '.*', which warm-starts all variables in the TRAINABLE_VARIABLES collection. Note that this excludes variables such as accumulators and moving statistics from batch norm. 
 
  var_name_to_vocab_info   [Optional] Dict of variable names (strings) to tf.estimator.VocabInfo. The variable names should be "full" variables, not the names of the partitions. If not explicitly provided, the variable is assumed to have no (changes to) vocabulary.  
  var_name_to_prev_var_name   [Optional] Dict of variable names (strings) to name of the previously-trained variable in ckpt_to_initialize_from. If not explicitly provided, the name of the variable is assumed to be same between previous checkpoint and current model. Note that this has no effect on the set of variables that is warm-started, and only controls name mapping (use vars_to_warm_start for controlling what variables to warm-start).   
 


 Raises
  ValueError   If the WarmStartSettings contains prev_var_name or VocabInfo configuration for variable names that are not used. This is to ensure a stronger check for variable configuration than relying on users to examine the logs.
tf.compat.v1.train.WorkerSessionCreator Creates a tf.compat.v1.Session for a worker. Inherits From: SessionCreator 
tf.compat.v1.train.WorkerSessionCreator(
    scaffold=None, master='', config=None, max_wait_secs=(30 * 60)
)

 


 Args
  scaffold   A Scaffold used for gathering or building supportive ops. If not specified a default one is created. It's used to finalize the graph.  
  master   String representation of the TensorFlow master to use.  
  config   ConfigProto proto used to configure the session.  
  max_wait_secs   Maximum time to wait for the session to become available.    Methods create_session View source 
create_session()
tf.compat.v1.trainable_variables Returns all variables created with trainable=True. 
tf.compat.v1.trainable_variables(
    scope=None
)
 When passed trainable=True, the Variable() constructor automatically adds new variables to the graph collection GraphKeys.TRAINABLE_VARIABLES. This convenience function returns the contents of that collection.
 


 Args
  scope   (Optional.) A string. If supplied, the resulting list is filtered to include only items whose name attribute matches scope using re.match. Items without a name attribute are never returned if a scope is supplied. The choice of re.match means that a scope without special tokens filters by prefix.   
 


 Returns   A list of Variable objects.
tf.compat.v1.transpose Transposes a. 
tf.compat.v1.transpose(
    a, perm=None, name='transpose', conjugate=False
)
 Permutes the dimensions according to perm. The returned tensor's dimension i will correspond to the input dimension perm[i]. If perm is not given, it is set to (n-1...0), where n is the rank of the input tensor. Hence by default, this operation performs a regular matrix transpose on 2-D input Tensors. If conjugate is True and a.dtype is either complex64 or complex128 then the values of a are conjugated and transposed. For example: x = tf.constant([[1, 2, 3], [4, 5, 6]])
tf.transpose(x)  # [[1, 4]
                 #  [2, 5]
                 #  [3, 6]]

# Equivalently
tf.transpose(x, perm=[1, 0])  # [[1, 4]
                              #  [2, 5]
                              #  [3, 6]]

# If x is complex, setting conjugate=True gives the conjugate transpose
x = tf.constant([[1 + 1j, 2 + 2j, 3 + 3j],
                 [4 + 4j, 5 + 5j, 6 + 6j]])
tf.transpose(x, conjugate=True)  # [[1 - 1j, 4 - 4j],
                                 #  [2 - 2j, 5 - 5j],
                                 #  [3 - 3j, 6 - 6j]]

# 'perm' is more useful for n-dimensional tensors, for n > 2
x = tf.constant([[[ 1,  2,  3],
                  [ 4,  5,  6]],
                 [[ 7,  8,  9],
                  [10, 11, 12]]])

# Take the transpose of the matrices in dimension-0
# (this common operation has a shorthand `linalg.matrix_transpose`)
tf.transpose(x, perm=[0, 2, 1])  # [[[1,  4],
                                 #   [2,  5],
                                 #   [3,  6]],
                                 #  [[7, 10],
                                 #   [8, 11],
                                 #   [9, 12]]]

 


 Args
  a   A Tensor.  
  perm   A permutation of the dimensions of a.  
  name   A name for the operation (optional).  
  conjugate   Optional bool. Setting it to True is mathematically equivalent to tf.math.conj(tf.transpose(input)).   
 


 Returns   A transposed Tensor.  
 Numpy Compatibility In numpy transposes are memory-efficient constant time operations as they simply return a new view of the same data with adjusted strides. TensorFlow does not support strides, so transpose returns a new tensor with the items permuted.
tf.compat.v1.truncated_normal_initializer Initializer that generates a truncated normal distribution.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.initializers.truncated_normal  
tf.compat.v1.truncated_normal_initializer(
    mean=0.0, stddev=1.0, seed=None, dtype=tf.dtypes.float32
)
 These values are similar to values from a random_normal_initializer except that values more than two standard deviations from the mean are discarded and re-drawn. This is the recommended initializer for neural network weights and filters.
 


 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. Used to create random seeds. See tf.compat.v1.set_random_seed for behavior.  
  dtype   Default data type, used if no dtype argument is provided when calling the initializer. Only floating point types are supported.    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, partition_info=None
)
 Returns a tensor object initialized as specified by the initializer.
 


 Args
  shape   Shape of the tensor.  
  dtype   Optional dtype of the tensor. If not provided use the initializer dtype.  
  partition_info   Optional information about the possible partitioning of a tensor.
tf.compat.v1.tuple Group tensors together. 
tf.compat.v1.tuple(
    tensors, name=None, control_inputs=None
)
 This creates a tuple of tensors with the same values as the tensors argument, except that the value of each tensor is only returned after the values of all tensors have been computed. control_inputs contains additional ops that have to finish before this op finishes, but whose outputs are not returned. This can be used as a "join" mechanism for parallel computations: all the argument tensors can be computed in parallel, but the values of any tensor returned by tuple are only available after all the parallel computations are done. See also tf.group and tf.control_dependencies.
 


 Args
  tensors   A list of Tensors or IndexedSlices, some entries can be None.  
  name   (optional) A name to use as a name_scope for the operation.  
  control_inputs   List of additional ops to finish before returning.   
 


 Returns   Same as tensors.  

 


 Raises
  ValueError   If tensors does not contain any Tensor or IndexedSlices.  
  TypeError   If control_inputs is not a list of Operation or Tensor objects.
Module: tf.compat.v1.types Public TensorFlow type definitions. For details, see https://github.com/tensorflow/community/blob/master/rfcs/20200211-tf-types.md Modules experimental module: Public API for tf.types.experimental namespace.
Module: tf.compat.v1.types.experimental Public API for tf.types.experimental namespace. Type Aliases TensorLike: Union of all types that can be converted to a tf.Tensor by tf.convert_to_tensor.
tf.compat.v1.uniform_unit_scaling_initializer Initializer that generates tensors without scaling variance.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.initializers.uniform_unit_scaling  
tf.compat.v1.uniform_unit_scaling_initializer(
    factor=1.0, seed=None, dtype=tf.dtypes.float32
)
 When initializing a deep network, it is in principle advantageous to keep the scale of the input variance constant, so it does not explode or diminish by reaching the final layer. If the input is x and the operation x * W, and we want to initialize W uniformly at random, we need to pick W from [-sqrt(3) / sqrt(dim), sqrt(3) / sqrt(dim)]
 to keep the scale intact, where dim = W.shape[0] (the size of the input). A similar calculation for convolutional networks gives an analogous result with dim equal to the product of the first 3 dimensions. When nonlinearities are present, we need to multiply this by a constant factor. See (Sussillo et al., 2014) for deeper motivation, experiments and the calculation of constants. In section 2.3 there, the constants were numerically computed: for a linear layer it's 1.0, relu: ~1.43, tanh: ~1.15.
 


 Args
  factor   Float. A multiplicative factor by which the values will be scaled.  
  seed   A Python integer. Used to create random seeds. See tf.compat.v1.set_random_seed for behavior.  
  dtype   Default data type, used if no dtype argument is provided when calling the initializer. Only floating point types are supported.    References: Sussillo 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, partition_info=None
)
 Returns a tensor object initialized as specified by the initializer.
 


 Args
  shape   Shape of the tensor.  
  dtype   Optional dtype of the tensor. If not provided use the initializer dtype.  
  partition_info   Optional information about the possible partitioning of a tensor.
Module: tf.compat.v1.user_ops Public API for tf.user_ops namespace. Functions my_fact(...): Example of overriding the generated code for an Op.
tf.compat.v1.user_ops.my_fact Example of overriding the generated code for an Op. 
tf.compat.v1.user_ops.my_fact()
tf.compat.v1.VariableAggregation Indicates how a distributed variable will be aggregated. tf.distribute.Strategy distributes a model by making multiple copies (called "replicas") acting data-parallel on different elements of the input batch. When performing some variable-update operation, say var.assign_add(x), in a model, we need to resolve how to combine the different values for x computed in the different replicas.  
NONE: This is the default, giving an error if you use a variable-update operation with multiple replicas. 
SUM: Add the updates across replicas. 
MEAN: Take the arithmetic mean ("average") of the updates across replicas. 
ONLY_FIRST_REPLICA: This is for when every replica is performing the same update, but we only want to perform the update once. Used, e.g., for the global step counter. 
ONLY_FIRST_TOWER: Deprecated alias for ONLY_FIRST_REPLICA. 
 


 Class Variables
  MEAN   tf.compat.v1.VariableAggregation  
  NONE   tf.compat.v1.VariableAggregation  
  ONLY_FIRST_REPLICA   tf.compat.v1.VariableAggregation  
  SUM   tf.compat.v1.VariableAggregation
tf.compat.v1.variables_initializer Returns an Op that initializes a list of variables.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.initializers.variables  
tf.compat.v1.variables_initializer(
    var_list, name='init'
)
 After you launch the graph in a session, you can run the returned Op to initialize all the variables in var_list. This Op runs all the initializers of the variables in var_list in parallel. Calling initialize_variables() is equivalent to passing the list of initializers to Group(). If var_list is empty, however, the function still returns an Op that can be run. That Op just has no effect.
 


 Args
  var_list   List of Variable objects to initialize.  
  name   Optional name for the returned operation.   
 


 Returns   An Op that run the initializers of all the specified variables.
tf.compat.v1.variable_axis_size_partitioner Get a partitioner for VariableScope to keep shards below max_shard_bytes. 
tf.compat.v1.variable_axis_size_partitioner(
    max_shard_bytes, axis=0, bytes_per_string_element=16, max_shards=None
)
 This partitioner will shard a Variable along one axis, attempting to keep the maximum shard size below max_shard_bytes. In practice, this is not always possible when sharding along only one axis. When this happens, this axis is sharded as much as possible (i.e., every dimension becomes a separate shard). If the partitioner hits the max_shards limit, then each shard may end up larger than max_shard_bytes. By default max_shards equals None and no limit on the number of shards is enforced. One reasonable value for max_shard_bytes is (64 << 20) - 1, or almost 64MB, to keep below the protobuf byte limit.
 


 Args
  max_shard_bytes   The maximum size any given shard is allowed to be.  
  axis   The axis to partition along. Default: outermost axis.  
  bytes_per_string_element   If the Variable is of type string, this provides an estimate of how large each scalar in the Variable is.  
  max_shards   The maximum number of shards in int created taking precedence over max_shard_bytes.   
 


 Returns   A partition function usable as the partitioner argument to variable_scope and get_variable.  

 


 Raises
  ValueError   If any of the byte counts are non-positive.
tf.compat.v1.variable_op_scope Deprecated: context manager for defining an op that creates variables. 
@tf_contextlib.contextmanager
tf.compat.v1.variable_op_scope(
    values, name_or_scope, default_name=None, initializer=None, regularizer=None,
    caching_device=None, partitioner=None, custom_getter=None, reuse=None,
    dtype=None, use_resource=None, constraint=None
)
tf.compat.v1.verify_tensor_all_finite Assert that the tensor does not contain any NaN's or Inf's.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.debugging.assert_all_finite  
tf.compat.v1.verify_tensor_all_finite(
    t=None, msg=None, name=None, x=None, message=None
)

 


 Args
  t   Tensor to check.  
  msg   Message to log on failure.  
  name   A name for this operation (optional).  
  x   Alias for t.  
  message   Alias for msg.   
 


 Returns   Same tensor as t.
Module: tf.compat.v1.version Public API for tf.version namespace.
 


 Other Members
  COMPILER_VERSION   '7.3.1 20180303'  
  GIT_VERSION   'v2.4.0-rc4-71-g582c8d236cb'  
  GRAPH_DEF_VERSION   561  
  GRAPH_DEF_VERSION_MIN_CONSUMER   0  
  GRAPH_DEF_VERSION_MIN_PRODUCER   0  
  VERSION   '2.4.0'
tf.compat.v1.where Return the elements, either from x or y, depending on the condition. 
tf.compat.v1.where(
    condition, x=None, y=None, name=None
)
 If both x and y are None, then this operation returns the coordinates of true elements of condition. The coordinates are returned in a 2-D tensor where the first dimension (rows) represents the number of true elements, and the second dimension (columns) represents the coordinates of the true elements. Keep in mind, the shape of the output tensor can vary depending on how many true values there are in input. Indices are output in row-major order. If both non-None, x and y must have the same shape. The condition tensor must be a scalar if x and y are scalar. If x and y are tensors of higher rank, then condition must be either a vector with size matching the first dimension of x, or must have the same shape as x. The condition tensor acts as a mask that chooses, based on the value at each element, whether the corresponding element / row in the output should be taken from x (if true) or y (if false). If condition is a vector and x and y are higher rank matrices, then it chooses which row (outer dimension) to copy from x and y. If condition has the same shape as x and y, then it chooses which element to copy from x and y.
 


 Args
  condition   A Tensor of type bool  
  x   A Tensor which may have the same shape as condition. If condition is rank 1, x may have higher rank, but its first dimension must match the size of condition.  
  y   A tensor with the same shape and type as x.  
  name   A name of the operation (optional)   
 


 Returns   A Tensor with the same type and shape as x, y if they are non-None. Otherwise, a Tensor with shape (num_true, rank(condition)).  

 


 Raises
  ValueError   When exactly one of x or y is non-None.
tf.compat.v1.wrap_function Wraps the TF 1.x function fn into a graph function. 
tf.compat.v1.wrap_function(
    fn, signature, name=None
)
 The python function fn will be called once with symbolic arguments specified in the signature, traced, and turned into a graph function. Any variables created by fn will be owned by the object returned by wrap_function. The resulting graph function can be called with tensors which match the signature. def f(x, do_add):
  v = tf.Variable(5.0)
  if do_add:
    op = v.assign_add(x)
  else:
    op = v.assign_sub(x)
  with tf.control_dependencies([op]):
    return v.read_value()

f_add = tf.compat.v1.wrap_function(f, [tf.TensorSpec((), tf.float32), True])

assert float(f_add(1.0)) == 6.0
assert float(f_add(1.0)) == 7.0

# Can call tf.compat.v1.wrap_function again to get a new trace, a new set
# of variables, and possibly different non-template arguments.
f_sub= tf.compat.v1.wrap_function(f, [tf.TensorSpec((), tf.float32), False])

assert float(f_sub(1.0)) == 4.0
assert float(f_sub(1.0)) == 3.0
 Both tf.compat.v1.wrap_function and tf.function create a callable TensorFlow graph. But while tf.function runs all stateful operations (e.g. tf.print) and sequences operations to provide the same semantics as eager execution, wrap_function is closer to the behavior of session.run in TensorFlow 1.x. It will not run any operations unless they are required to compute the function's outputs, either through a data dependency or a control dependency. Nor will it sequence operations. Unlike tf.function, wrap_function will only trace the Python function once. As with placeholders in TF 1.x, shapes and dtypes must be provided to wrap_function's signature argument. Since it is only traced once, variables and state may be created inside the function and owned by the function wrapper object.
 


 Args
  fn   python function to be wrapped  
  signature   the placeholder and python arguments to be passed to the wrapped function  
  name   Optional. The name of the function.   
 


 Returns   the wrapped graph function.
Module: tf.compat.v1.xla Public API for tf.xla namespace. Modules experimental module: Public API for tf.xla.experimental namespace.
Module: tf.compat.v1.xla.experimental Public API for tf.xla.experimental namespace. Functions compile(...): Builds an operator that compiles and runs computation with XLA. (deprecated) jit_scope(...): Enable or disable JIT compilation of operators within the scope.
tf.compat.v1.zeros_like Creates a tensor with all elements set to zero. 
tf.compat.v1.zeros_like(
    tensor, dtype=None, name=None, optimize=True
)
 See also tf.zeros. Given a single tensor (tensor), this operation returns a tensor of the same type and shape as tensor with all elements set to zero. Optionally, you can use dtype to specify a new type for the returned tensor. Examples: 
tensor = tf.constant([[1, 2, 3], [4, 5, 6]])
tf.zeros_like(tensor)
<tf.Tensor: shape=(2, 3), dtype=int32, numpy=
array([[0, 0, 0],
       [0, 0, 0]], dtype=int32)>
 
tf.zeros_like(tensor, dtype=tf.float32)
<tf.Tensor: shape=(2, 3), dtype=float32, numpy=
array([[0., 0., 0.],
       [0., 0., 0.]], dtype=float32)>

 


 Args
  tensor   A Tensor.  
  dtype   A type for the returned Tensor. Must be float16, float32, float64, int8, uint8, int16, uint16, int32, int64, complex64, complex128, bool or string. (optional)  
  name   A name for the operation (optional).  
  optimize   if True, attempt to statically determine the shape of tensor and encode it as a constant. (optional, defaults to True)   
 


 Returns   A Tensor with all elements set to zero.