neulab/docprompting-conala huggingface dataset:
tf.compat.v1.test.StubOutForTesting Support class for stubbing methods out for unit testing. 
tf.compat.v1.test.StubOutForTesting()
 Sample Usage: You want os.path.exists() to always return true during testing. stubs = StubOutForTesting() stubs.Set(os.path, 'exists', lambda x: 1) ... stubs.CleanUp() The above changes os.path.exists into a lambda that returns 1. Once the ... part of the code finishes, the CleanUp() looks up the old value of os.path.exists and restores it. Methods CleanUp View source 
CleanUp()
 Undoes all SmartSet() & Set() calls, restoring original definitions. Set View source 
Set(
    parent, child_name, new_child
)
 In parent, replace child_name's old definition with new_child. The parent could be a module when the child is a function at module scope. Or the parent could be a class when a class' method is being replaced. The named child is set to new_child, while the prior definition is saved away for later, when UnsetAll() is called. This method supports the case where child_name is a staticmethod or a classmethod of parent.
 


 Args
  parent   The context in which the attribute child_name is to be changed.  
  child_name   The name of the attribute to change.  
  new_child   The new value of the attribute.    SmartSet View source 
SmartSet(
    obj, attr_name, new_attr
)
 Replace obj.attr_name with new_attr. This method is smart and works at the module, class, and instance level while preserving proper inheritance. It will not stub out C types however unless that has been explicitly allowed by the type. This method supports the case where attr_name is a staticmethod or a classmethod of obj. Notes:  If obj is an instance, then it is its class that will actually be stubbed. Note that the method Set() does not do that: if obj is an instance, it (and not its class) will be stubbed. The stubbing is using the builtin getattr and setattr. So, the get and set will be called when stubbing ( probably be to manipulate obj.dict instead of getattr() and setattr()). 
 


 Args
  obj   The object whose attributes we want to modify.  
  attr_name   The name of the attribute to modify.  
  new_attr   The new value for the attribute.   
 


 Raises
  AttributeError   If the attribute cannot be found.    SmartUnsetAll View source 
SmartUnsetAll()
 Reverses SmartSet() calls, restoring things to original definitions. This method is automatically called when the StubOutForTesting() object is deleted; there is no need to call it explicitly. It is okay to call SmartUnsetAll() repeatedly, as later calls have no effect if no SmartSet() calls have been made. UnsetAll View source 
UnsetAll()
 Reverses Set() calls, restoring things to their original definitions. This method is automatically called when the StubOutForTesting() object is deleted; there is no need to call it explicitly. It is okay to call UnsetAll() repeatedly, as later calls have no effect if no Set() calls have been made. __enter__ View source 
__enter__()
 __exit__ View source 
__exit__(
    unused_exc_type, unused_exc_value, unused_tb
)
tf.compat.v1.test.test_src_dir_path Creates an absolute test srcdir path given a relative path. 
tf.compat.v1.test.test_src_dir_path(
    relative_path
)

 


 Args
  relative_path   a path relative to tensorflow root. e.g. "core/platform".   
 


 Returns   An absolute path to the linked in runfiles.
tf.compat.v1.to_bfloat16 Casts a tensor to type bfloat16. (deprecated) 
tf.compat.v1.to_bfloat16(
    x, name='ToBFloat16'
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use tf.cast instead.
 


 Args
  x   A Tensor or SparseTensor or IndexedSlices.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor or SparseTensor or IndexedSlices with same shape as x with type bfloat16.  

 


 Raises
  TypeError   If x cannot be cast to the bfloat16.
tf.compat.v1.to_complex128 Casts a tensor to type complex128. (deprecated) 
tf.compat.v1.to_complex128(
    x, name='ToComplex128'
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use tf.cast instead.
 


 Args
  x   A Tensor or SparseTensor or IndexedSlices.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor or SparseTensor or IndexedSlices with same shape as x with type complex128.  

 


 Raises
  TypeError   If x cannot be cast to the complex128.
tf.compat.v1.to_complex64 Casts a tensor to type complex64. (deprecated) 
tf.compat.v1.to_complex64(
    x, name='ToComplex64'
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use tf.cast instead.
 


 Args
  x   A Tensor or SparseTensor or IndexedSlices.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor or SparseTensor or IndexedSlices with same shape as x with type complex64.  

 


 Raises
  TypeError   If x cannot be cast to the complex64.
tf.compat.v1.to_double Casts a tensor to type float64. (deprecated) 
tf.compat.v1.to_double(
    x, name='ToDouble'
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use tf.cast instead.
 


 Args
  x   A Tensor or SparseTensor or IndexedSlices.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor or SparseTensor or IndexedSlices with same shape as x with type float64.  

 


 Raises
  TypeError   If x cannot be cast to the float64.
tf.compat.v1.to_float Casts a tensor to type float32. (deprecated) 
tf.compat.v1.to_float(
    x, name='ToFloat'
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use tf.cast instead.
 


 Args
  x   A Tensor or SparseTensor or IndexedSlices.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor or SparseTensor or IndexedSlices with same shape as x with type float32.  

 


 Raises
  TypeError   If x cannot be cast to the float32.
tf.compat.v1.to_int32 Casts a tensor to type int32. (deprecated) 
tf.compat.v1.to_int32(
    x, name='ToInt32'
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use tf.cast instead.
 


 Args
  x   A Tensor or SparseTensor or IndexedSlices.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor or SparseTensor or IndexedSlices with same shape as x with type int32.  

 


 Raises
  TypeError   If x cannot be cast to the int32.
tf.compat.v1.to_int64 Casts a tensor to type int64. (deprecated) 
tf.compat.v1.to_int64(
    x, name='ToInt64'
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use tf.cast instead.
 


 Args
  x   A Tensor or SparseTensor or IndexedSlices.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor or SparseTensor or IndexedSlices with same shape as x with type int64.  

 


 Raises
  TypeError   If x cannot be cast to the int64.
Module: tf.compat.v1.tpu Ops related to Tensor Processing Units. Modules experimental module: Public API for tf.tpu.experimental namespace. Classes class CrossShardOptimizer: An optimizer that averages gradients across TPU shards. class PaddingSpec: Represents the type of padding policies for tpu.replicate. class XLAOptions: XLA compilation options. Functions batch_parallel(...): Shards computation along the batch dimension for parallel execution. bfloat16_scope(...): Scope class for bfloat16 variables so that the model uses custom getter. core(...): Returns the device name for a core in a replicated TPU computation. cross_replica_sum(...): Sum the input tensor across replicas according to group_assignment. initialize_system(...): Initializes a distributed TPU system for use with TensorFlow. outside_compilation(...): Builds part of a computation outside any current TPU replicate scope. replicate(...): Builds a graph operator that runs a replicated TPU computation. rewrite(...): Rewrites computation for execution on a TPU system. shard(...): Shards computation for parallel execution. shutdown_system(...): Shuts down a running a distributed TPU system.
tf.compat.v1.tpu.batch_parallel Shards computation along the batch dimension for parallel execution. 
tf.compat.v1.tpu.batch_parallel(
    computation, inputs=None, num_shards=1, infeed_queue=None,
    device_assignment=None, name=None, xla_options=None
)
 Convenience wrapper around shard(). inputs must be a list of Tensors or None (equivalent to an empty list). Each input is split into num_shards pieces along the 0-th dimension, and computation is applied to each shard in parallel. Tensors are broadcast to all shards if they are lexically captured by computation. e.g., x = tf.constant(7) def computation(): return x + 3 ... = shard(computation, ...) The outputs from all shards are concatenated back together along their 0-th dimension. Inputs and outputs of the computation must be at least rank-1 Tensors.
 


 Args
  computation   A Python function that builds a computation to apply to each shard of the input.  
  inputs   A list of input tensors or None (equivalent to an empty list). The 0-th dimension of each Tensor must have size divisible by num_shards.  
  num_shards   The number of shards.  
  infeed_queue   If not None, the InfeedQueue from which to append a tuple of arguments as inputs to computation.  
  device_assignment   If not None, a DeviceAssignment describing the mapping between logical cores in the computation with physical cores in the TPU topology. Uses a default device assignment if None. The DeviceAssignment may be omitted if each shard of the computation uses only one core, and there is either only one shard, or the number of shards is equal to the number of cores in the TPU system.  
  name   (Deprecated) Does nothing.  
  xla_options   An instance of tpu.XLAOptions which indicates the options passed to XLA compiler. Use None for default options.   
 


 Returns   A list of output tensors.  

 


 Raises
  ValueError   If num_shards <= 0
tf.compat.v1.tpu.bfloat16_scope Scope class for bfloat16 variables so that the model uses custom getter. 
@tf_contextlib.contextmanager
tf.compat.v1.tpu.bfloat16_scope(
    name=None
)
 This enables variables to be read as bfloat16 type when using get_variable.
tf.compat.v1.tpu.core Returns the device name for a core in a replicated TPU computation. 
tf.compat.v1.tpu.core(
    num
)

 


 Args
  num   the virtual core number within each replica to which operators should be assigned.   
 


 Returns   A device name, suitable for passing to tf.device().
tf.compat.v1.tpu.cross_replica_sum Sum the input tensor across replicas according to group_assignment. 
tf.compat.v1.tpu.cross_replica_sum(
    x, group_assignment=None, name=None
)

 


 Args
  x   The local tensor to the sum.  
  group_assignment   Optional 2d int32 lists with shape [num_groups, num_replicas_per_group]. group_assignment[i] represents the replica ids in the ith subgroup.  
  name   Optional op name.   
 


 Returns   A Tensor which is summed across replicas.
Module: tf.compat.v1.tpu.experimental Public API for tf.tpu.experimental namespace. Modules embedding module: Public API for tf.tpu.experimental.embedding namespace. Classes class AdagradParameters: Optimization parameters for Adagrad with TPU embeddings. class AdamParameters: Optimization parameters for Adam with TPU embeddings. class DeviceAssignment: Mapping from logical cores in a computation to the physical TPU topology. class FtrlParameters: Optimization parameters for Ftrl with TPU embeddings. class StochasticGradientDescentParameters: Optimization parameters for stochastic gradient descent for TPU embeddings. class TPUSystemMetadata: Describes some metadata about the TPU system. class Topology: Describes a set of TPU devices. Functions embedding_column(...): TPU version of tf.compat.v1.feature_column.embedding_column. initialize_tpu_system(...): Initialize the TPU devices. shared_embedding_columns(...): TPU version of tf.compat.v1.feature_column.shared_embedding_columns. shutdown_tpu_system(...): Shuts down the TPU devices.
tf.compat.v1.tpu.experimental.AdagradParameters Optimization parameters for Adagrad with TPU embeddings. 
tf.compat.v1.tpu.experimental.AdagradParameters(
    learning_rate: float,
    initial_accumulator: float = 0.1,
    use_gradient_accumulation: bool = True,
    clip_weight_min: Optional[float] = None,
    clip_weight_max: Optional[float] = None,
    weight_decay_factor: Optional[float] = None,
    multiply_weight_decay_factor_by_learning_rate: Optional[bool] = None,
    clip_gradient_min: Optional[float] = None,
    clip_gradient_max: Optional[float] = None
)
 Pass this to tf.estimator.tpu.experimental.EmbeddingConfigSpec via the optimization_parameters argument to set the optimizer and its parameters. See the documentation for tf.estimator.tpu.experimental.EmbeddingConfigSpec for more details. estimator = tf.estimator.tpu.TPUEstimator(
    ...
    embedding_spec=tf.estimator.tpu.experimental.EmbeddingConfigSpec(
        ...
        optimization_parameters=tf.tpu.experimental.AdagradParameters(0.1),
        ...))

 


 Args
  learning_rate   used for updating embedding table.  
  initial_accumulator   initial accumulator for Adagrad.  
  use_gradient_accumulation   setting this to False makes embedding gradients calculation less accurate but faster. Please see optimization_parameters.proto for details. for details.  
  clip_weight_min   the minimum value to clip by; None means -infinity.  
  clip_weight_max   the maximum value to clip by; None means +infinity.  
  weight_decay_factor   amount of weight decay to apply; None means that the weights are not decayed.  
  multiply_weight_decay_factor_by_learning_rate   if true, weight_decay_factor is multiplied by the current learning rate.  
  clip_gradient_min   the minimum value to clip by; None means -infinity.  
  clip_gradient_max   the maximum value to clip by; None means +infinity.
tf.compat.v1.tpu.experimental.AdamParameters Optimization parameters for Adam with TPU embeddings. 
tf.compat.v1.tpu.experimental.AdamParameters(
    learning_rate: float,
    beta1: float = 0.9,
    beta2: float = 0.999,
    epsilon: float = 1e-08,
    lazy_adam: bool = True,
    sum_inside_sqrt: bool = True,
    use_gradient_accumulation: bool = True,
    clip_weight_min: Optional[float] = None,
    clip_weight_max: Optional[float] = None,
    weight_decay_factor: Optional[float] = None,
    multiply_weight_decay_factor_by_learning_rate: Optional[bool] = None,
    clip_gradient_min: Optional[float] = None,
    clip_gradient_max: Optional[float] = None
)
 Pass this to tf.estimator.tpu.experimental.EmbeddingConfigSpec via the optimization_parameters argument to set the optimizer and its parameters. See the documentation for tf.estimator.tpu.experimental.EmbeddingConfigSpec for more details. estimator = tf.estimator.tpu.TPUEstimator(
    ...
    embedding_config_spec=tf.estimator.tpu.experimental.EmbeddingConfigSpec(
        ...
        optimization_parameters=tf.tpu.experimental.AdamParameters(0.1),
        ...))

 


 Args
  learning_rate   a floating point value. The learning rate.  
  beta1   A float value. The exponential decay rate for the 1st moment estimates.  
  beta2   A float value. The exponential decay rate for the 2nd moment estimates.  
  epsilon   A small constant for numerical stability.  
  lazy_adam   Use lazy Adam instead of Adam. Lazy Adam trains faster. Please see optimization_parameters.proto for details.  
  sum_inside_sqrt   This improves training speed. Please see optimization_parameters.proto for details.  
  use_gradient_accumulation   setting this to False makes embedding gradients calculation less accurate but faster. Please see optimization_parameters.proto for details. for details.  
  clip_weight_min   the minimum value to clip by; None means -infinity.  
  clip_weight_max   the maximum value to clip by; None means +infinity.  
  weight_decay_factor   amount of weight decay to apply; None means that the weights are not decayed.  
  multiply_weight_decay_factor_by_learning_rate   if true, weight_decay_factor is multiplied by the current learning rate.  
  clip_gradient_min   the minimum value to clip by; None means -infinity.  
  clip_gradient_max   the maximum value to clip by; None means +infinity.
Module: tf.compat.v1.tpu.experimental.embedding Public API for tf.tpu.experimental.embedding namespace. Classes class Adagrad: Optimization parameters for Adagrad with TPU embeddings. class Adam: Optimization parameters for Adam with TPU embeddings. class FeatureConfig: Configuration data for one embedding feature. class SGD: Optimization parameters for stochastic gradient descent for TPU embeddings. class TPUEmbedding: The TPUEmbedding mid level API. class TableConfig: Configuration data for one embedding table. Functions serving_embedding_lookup(...): Apply standard lookup ops with tf.tpu.experimental.embedding configs.
tf.compat.v1.tpu.experimental.FtrlParameters Optimization parameters for Ftrl with TPU embeddings. 
tf.compat.v1.tpu.experimental.FtrlParameters(
    learning_rate: float,
    learning_rate_power: float = -0.5,
    initial_accumulator_value: float = 0.1,
    l1_regularization_strength: float = 0.0,
    l2_regularization_strength: float = 0.0,
    use_gradient_accumulation: bool = True,
    clip_weight_min: Optional[float] = None,
    clip_weight_max: Optional[float] = None,
    weight_decay_factor: Optional[float] = None,
    multiply_weight_decay_factor_by_learning_rate: Optional[bool] = None,
    multiply_linear_by_learning_rate: bool = False,
    beta: float = 0,
    allow_zero_accumulator: bool = False,
    clip_gradient_min: Optional[float] = None,
    clip_gradient_max: Optional[float] = None
)
 Pass this to tf.estimator.tpu.experimental.EmbeddingConfigSpec via the optimization_parameters argument to set the optimizer and its parameters. See the documentation for tf.estimator.tpu.experimental.EmbeddingConfigSpec for more details. estimator = tf.estimator.tpu.TPUEstimator(
    ...
    embedding_config_spec=tf.estimator.tpu.experimental.EmbeddingConfigSpec(
        ...
        optimization_parameters=tf.tpu.experimental.FtrlParameters(0.1),
        ...))

 


 Args
  learning_rate   a floating point value. The learning rate.  
  learning_rate_power   A float value, must be less or equal to zero. Controls how the learning rate decreases during training. Use zero for a fixed learning rate. See section 3.1 in the paper.  
  initial_accumulator_value   The starting value for accumulators. Only zero or positive values are allowed.  
  l1_regularization_strength   A float value, must be greater than or equal to zero.  
  l2_regularization_strength   A float value, must be greater than or equal to zero.  
  use_gradient_accumulation   setting this to False makes embedding gradients calculation less accurate but faster. Please see optimization_parameters.proto for details. for details.  
  clip_weight_min   the minimum value to clip by; None means -infinity.  
  clip_weight_max   the maximum value to clip by; None means +infinity.  
  weight_decay_factor   amount of weight decay to apply; None means that the weights are not decayed.  
  multiply_weight_decay_factor_by_learning_rate   if true, weight_decay_factor is multiplied by the current learning rate.  
  multiply_linear_by_learning_rate   When true, multiplies the usages of the linear slot in the weight update by the learning rate. This is useful when ramping up learning rate from 0 (which would normally produce NaNs).  
  beta   The beta parameter for FTRL.  
  allow_zero_accumulator   Changes the implementation of the square root to allow for the case of initial_accumulator_value being zero. This will cause a slight performance drop.  
  clip_gradient_min   the minimum value to clip by; None means -infinity.  
  clip_gradient_max   the maximum value to clip by; None means +infinity.
tf.compat.v1.tpu.experimental.StochasticGradientDescentParameters Optimization parameters for stochastic gradient descent for TPU embeddings. 
tf.compat.v1.tpu.experimental.StochasticGradientDescentParameters(
    learning_rate: float,
    clip_weight_min: Optional[float] = None,
    clip_weight_max: Optional[float] = None,
    weight_decay_factor: Optional[float] = None,
    multiply_weight_decay_factor_by_learning_rate: Optional[bool] = None,
    clip_gradient_min: Optional[float] = None,
    clip_gradient_max: Optional[float] = None
)
 Pass this to tf.estimator.tpu.experimental.EmbeddingConfigSpec via the optimization_parameters argument to set the optimizer and its parameters. See the documentation for tf.estimator.tpu.experimental.EmbeddingConfigSpec for more details. estimator = tf.estimator.tpu.TPUEstimator(
    ...
    embedding_config_spec=tf.estimator.tpu.experimental.EmbeddingConfigSpec(
        ...
        optimization_parameters=(
            tf.tpu.experimental.StochasticGradientDescentParameters(0.1))))

 


 Args
  learning_rate   a floating point value. The learning rate.  
  clip_weight_min   the minimum value to clip by; None means -infinity.  
  clip_weight_max   the maximum value to clip by; None means +infinity.  
  weight_decay_factor   amount of weight decay to apply; None means that the weights are not decayed.  
  multiply_weight_decay_factor_by_learning_rate   if true, weight_decay_factor is multiplied by the current learning rate.  
  clip_gradient_min   the minimum value to clip by; None means -infinity.  
  clip_gradient_max   the maximum value to clip by; None means +infinity.
tf.compat.v1.tpu.initialize_system Initializes a distributed TPU system for use with TensorFlow. 
tf.compat.v1.tpu.initialize_system(
    embedding_config=None, job=None, compilation_failure_closes_chips=True
)

 


 Args
  embedding_config   If not None, a TPUEmbeddingConfiguration proto describing the desired configuration of the hardware embedding lookup tables. If embedding_config is None, no hardware embeddings can be used.  
  job   The job (the XXX in TensorFlow device specification /job:XXX) that contains the TPU devices that will be initialized. If job=None it is assumed there is only one job in the TensorFlow flock, and an error will be returned if this assumption does not hold.  
  compilation_failure_closes_chips   Set the configuration whether we want to close TPU chips when there is a compilation failure.   
 


 Returns   A serialized TopologyProto that describes the TPU system. Note: the topology must be evaluated using Session.run before it can be used.