neulab/docprompting-conala huggingface dataset:
tf.profiler.experimental.ProfilerOptions Options for finer control over the profiler. 
tf.profiler.experimental.ProfilerOptions(
    host_tracer_level=2, python_tracer_level=0, device_tracer_level=1, delay_ms=None
)
 Use tf.profiler.ProfilerOptions to control tf.profiler behavior. Fields:  
host_tracer_level: Adjust CPU tracing level. Values are: 1 - critical info only, 2 - info, 3 - verbose. [default value is 2] 
python_tracer_level: Toggle tracing of Python function calls. Values are: 1 enabled, 0 - disabled [default value is 0] 
device_tracer_level: Adjust device (TPU/GPU) tracing level. Values are: 1 - enabled, 0 - disabled [default value is 1] 
delay_ms: Requests for all hosts to start profiling at a timestamp that is delay_ms away from the current time. delay_ms is in milliseconds. If zero, each host will start profiling immediately upon receiving the request. Default value is None, allowing the profiler guess the best value. 
 


 Attributes
  host_tracer_level  
 
  python_tracer_level  
 
  device_tracer_level  
 
  delay_ms
Module: tf.profiler.experimental.server Public API for tf.profiler.experimental.server namespace. Functions start(...): Start a profiler grpc server that listens to given port.
tf.profiler.experimental.server.start Start a profiler grpc server that listens to given port. 
tf.profiler.experimental.server.start(
    port
)
 The profiler server will exit when the process finishes. The service is defined in tensorflow/core/profiler/profiler_service.proto.
 


 Args
  port   port profiler server listens to.    Example usage: ```python tf.profiler.experimental.server.start('6009') # do your training here.
tf.profiler.experimental.start Start profiling TensorFlow performance. 
tf.profiler.experimental.start(
    logdir, options=None
)

 


 Args
  logdir   Profiling results log directory.  
  options   ProfilerOptions namedtuple to specify miscellaneous profiler options. See example usage below.   
 


 Raises
  AlreadyExistsError   If a profiling session is already running.    Example usage: options = tf.profiler.experimental.ProfilerOptions(host_tracer_level = 3,
                                                   python_tracer_level = 1,
                                                   device_tracer_level = 1)
tf.profiler.experimental.start('logdir_path', options = options)
# Training code here
tf.profiler.experimental.stop()
 To view the profiling results, launch TensorBoard and point it to logdir. Open your browser and go to localhost:6006/#profile to view profiling results.
tf.profiler.experimental.stop Stops the current profiling session. 
tf.profiler.experimental.stop(
    save=True
)
 The profiler session will be stopped and profile results can be saved.
 


 Args
  save   An optional variable to save the results to TensorBoard. Default True.   
 


 Raises
  UnavailableError   If there is no active profiling session.
tf.profiler.experimental.Trace Context manager that generates a trace event in the profiler. 
tf.profiler.experimental.Trace(
    name, **kwargs
)
 A trace event will start when entering the context, and stop and save the result to the profiler when exiting the context. Open TensorBoard Profile tab and choose trace viewer to view the trace event in the timeline. Trace events are created only when the profiler is enabled. More information on how to use the profiler can be found at https://tensorflow.org/guide/profiler Example usage: tf.profiler.experimental.start('logdir')
for step in range(num_steps):
  # Creates a trace event for each training step with the step number.
  with tf.profiler.experimental.Trace("Train", step_num=step):
    train_fn()
tf.profiler.experimental.stop()

 


 Args
  name   The name of the trace event.  
  **kwargs   Keyword arguments added to the trace event. Both the key and value are of types that can be converted to strings, which will be interpreted by the profiler according to the traceme name. Example usage: 
tf.profiler.experimental.start('logdir')
for step in range(num_steps):
# Creates a trace event for each training step with the
# step number.
with tf.profiler.experimental.Trace("Train", step_num=step):
train_fn()
tf.profiler.experimental.stop()

 The example above uses the keyword argument "step_num" to specify the training step being traced. 
   Methods set_metadata View source 
set_metadata(
    **kwargs
)
 Sets metadata in this trace event.
 


 Args
  **kwargs   metadata in key-value pairs.    This method enables setting metadata in a trace event after it is created. Example usage: 
def call(function):
  with tf.profiler.experimental.Trace("call",
       function_name=function.name) as tm:
    binary, in_cache = jit_compile(function)
    tm.set_metadata(in_cache=in_cache)
    execute(binary)

 In this example, we want to trace how much time spent on calling a function, which includes compilation and execution. The compilation can be either getting a cached copy of the binary or actually generating the binary, which is indicated by the boolean "in_cache" returned by jit_compile(). We need to use set_metadata() to pass in_cache because we did not know the in_cache value when the trace was created (and we cannot create the trace after jit_compile(), because we want to measure the entire duration of call()). __enter__ View source 
__enter__()
 __exit__ View source 
__exit__(
    exc_type, exc_val, exc_tb
)
Module: tf.quantization Public API for tf.quantization namespace. Functions dequantize(...): Dequantize the 'input' tensor into a float or bfloat16 Tensor. fake_quant_with_min_max_args(...): Fake-quantize the 'inputs' tensor, type float to 'outputs' tensor of same type. fake_quant_with_min_max_args_gradient(...): Compute gradients for a FakeQuantWithMinMaxArgs operation. fake_quant_with_min_max_vars(...): Fake-quantize the 'inputs' tensor of type float via global float scalars fake_quant_with_min_max_vars_gradient(...): Compute gradients for a FakeQuantWithMinMaxVars operation. fake_quant_with_min_max_vars_per_channel(...): Fake-quantize the 'inputs' tensor of type float via per-channel floats fake_quant_with_min_max_vars_per_channel_gradient(...): Compute gradients for a FakeQuantWithMinMaxVarsPerChannel operation. quantize(...): Quantize the 'input' tensor of type float to 'output' tensor of type 'T'. quantize_and_dequantize(...): Quantizes then dequantizes a tensor. (deprecated) quantize_and_dequantize_v2(...): Quantizes then dequantizes a tensor. quantized_concat(...): Concatenates quantized tensors along one dimension.
tf.quantization.fake_quant_with_min_max_args Fake-quantize the 'inputs' tensor, type float to 'outputs' tensor of same type.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.fake_quant_with_min_max_args, tf.compat.v1.quantization.fake_quant_with_min_max_args  
tf.quantization.fake_quant_with_min_max_args(
    inputs, min=-6, max=6, num_bits=8, narrow_range=False, name=None
)
 Attributes  
[min; max] define the clamping range for the inputs data. 
inputs values are quantized into the quantization range ( [0; 2^num_bits - 1] when narrow_range is false and [1; 2^num_bits - 1] when it is true) and then de-quantized and output as floats in [min; max] interval. 
num_bits is the bitwidth of the quantization; between 2 and 16, inclusive.  Before quantization, min and max values are adjusted with the following logic. It is suggested to have min <= 0 <= max. If 0 is not in the range of values, the behavior can be unexpected:  If 0 < min < max: min_adj = 0 and max_adj = max - min. If min < max < 0: min_adj = min - max and max_adj = 0. If min <= 0 <= max: scale = (max - min) / (2^num_bits - 1), min_adj = scale * round(min / scale) and max_adj = max + min_adj - min.  Quantization is called fake since the output is still in floating point.
 


 Args
  inputs   A Tensor of type float32.  
  min   An optional float. Defaults to -6.  
  max   An optional float. Defaults to 6.  
  num_bits   An optional int. Defaults to 8.  
  narrow_range   An optional bool. Defaults to False.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor of type float32.
tf.quantization.fake_quant_with_min_max_args_gradient Compute gradients for a FakeQuantWithMinMaxArgs operation.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.fake_quant_with_min_max_args_gradient, tf.compat.v1.quantization.fake_quant_with_min_max_args_gradient  
tf.quantization.fake_quant_with_min_max_args_gradient(
    gradients, inputs, min=-6, max=6, num_bits=8, narrow_range=False, name=None
)

 


 Args
  gradients   A Tensor of type float32. Backpropagated gradients above the FakeQuantWithMinMaxArgs operation.  
  inputs   A Tensor of type float32. Values passed as inputs to the FakeQuantWithMinMaxArgs operation.  
  min   An optional float. Defaults to -6.  
  max   An optional float. Defaults to 6.  
  num_bits   An optional int. Defaults to 8.  
  narrow_range   An optional bool. Defaults to False.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor of type float32.
tf.quantization.fake_quant_with_min_max_vars Fake-quantize the 'inputs' tensor of type float via global float scalars  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.fake_quant_with_min_max_vars, tf.compat.v1.quantization.fake_quant_with_min_max_vars  
tf.quantization.fake_quant_with_min_max_vars(
    inputs, min, max, num_bits=8, narrow_range=False, name=None
)
 Fake-quantize the inputs tensor of type float via global float scalars min and max to outputs tensor of same shape as inputs. Attributes  
[min; max] define the clamping range for the inputs data. 
inputs values are quantized into the quantization range ( [0; 2^num_bits - 1] when narrow_range is false and [1; 2^num_bits - 1] when it is true) and then de-quantized and output as floats in [min; max] interval. 
num_bits is the bitwidth of the quantization; between 2 and 16, inclusive.  Before quantization, min and max values are adjusted with the following logic. It is suggested to have min <= 0 <= max. If 0 is not in the range of values, the behavior can be unexpected:  If 0 < min < max: min_adj = 0 and max_adj = max - min. If min < max < 0: min_adj = min - max and max_adj = 0. If min <= 0 <= max: scale = (max - min) / (2^num_bits - 1), min_adj = scale * round(min / scale) and max_adj = max + min_adj - min.  This operation has a gradient and thus allows for training min and max values.
 


 Args
  inputs   A Tensor of type float32.  
  min   A Tensor of type float32.  
  max   A Tensor of type float32.  
  num_bits   An optional int. Defaults to 8.  
  narrow_range   An optional bool. Defaults to False.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor of type float32.
tf.quantization.fake_quant_with_min_max_vars_gradient Compute gradients for a FakeQuantWithMinMaxVars operation.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.fake_quant_with_min_max_vars_gradient, tf.compat.v1.quantization.fake_quant_with_min_max_vars_gradient  
tf.quantization.fake_quant_with_min_max_vars_gradient(
    gradients, inputs, min, max, num_bits=8, narrow_range=False, name=None
)

 


 Args
  gradients   A Tensor of type float32. Backpropagated gradients above the FakeQuantWithMinMaxVars operation.  
  inputs   A Tensor of type float32. Values passed as inputs to the FakeQuantWithMinMaxVars operation. min, max: Quantization interval, scalar floats.  
  min   A Tensor of type float32.  
  max   A Tensor of type float32.  
  num_bits   An optional int. Defaults to 8. The bitwidth of the quantization; between 2 and 8, inclusive.  
  narrow_range   An optional bool. Defaults to False. Whether to quantize into 2^num_bits - 1 distinct values.  
  name   A name for the operation (optional).   
 


 Returns   A tuple of Tensor objects (backprops_wrt_input, backprop_wrt_min, backprop_wrt_max).     backprops_wrt_input   A Tensor of type float32.  
  backprop_wrt_min   A Tensor of type float32.  
  backprop_wrt_max   A Tensor of type float32.
tf.quantization.fake_quant_with_min_max_vars_per_channel Fake-quantize the 'inputs' tensor of type float via per-channel floats  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.fake_quant_with_min_max_vars_per_channel, tf.compat.v1.quantization.fake_quant_with_min_max_vars_per_channel  
tf.quantization.fake_quant_with_min_max_vars_per_channel(
    inputs, min, max, num_bits=8, narrow_range=False, name=None
)
 Fake-quantize the inputs tensor of type float per-channel and one of the shapes: [d], [b, d] [b, h, w, d] via per-channel floats min and max of shape [d] to outputs tensor of same shape as inputs. Attributes  
[min; max] define the clamping range for the inputs data. 
inputs values are quantized into the quantization range ( [0; 2^num_bits - 1] when narrow_range is false and [1; 2^num_bits - 1] when it is true) and then de-quantized and output as floats in [min; max] interval. 
num_bits is the bitwidth of the quantization; between 2 and 16, inclusive.  Before quantization, min and max values are adjusted with the following logic. It is suggested to have min <= 0 <= max. If 0 is not in the range of values, the behavior can be unexpected:  If 0 < min < max: min_adj = 0 and max_adj = max - min. If min < max < 0: min_adj = min - max and max_adj = 0. If min <= 0 <= max: scale = (max - min) / (2^num_bits - 1), min_adj = scale * round(min / scale) and max_adj = max + min_adj - min.  This operation has a gradient and thus allows for training min and max values.
 


 Args
  inputs   A Tensor of type float32.  
  min   A Tensor of type float32.  
  max   A Tensor of type float32.  
  num_bits   An optional int. Defaults to 8.  
  narrow_range   An optional bool. Defaults to False.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor of type float32.
tf.quantization.fake_quant_with_min_max_vars_per_channel_gradient Compute gradients for a FakeQuantWithMinMaxVarsPerChannel operation.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.fake_quant_with_min_max_vars_per_channel_gradient, tf.compat.v1.quantization.fake_quant_with_min_max_vars_per_channel_gradient  
tf.quantization.fake_quant_with_min_max_vars_per_channel_gradient(
    gradients, inputs, min, max, num_bits=8, narrow_range=False, name=None
)

 


 Args
  gradients   A Tensor of type float32. Backpropagated gradients above the FakeQuantWithMinMaxVars operation, shape one of: [d], [b, d], [b, h, w, d].  
  inputs   A Tensor of type float32. Values passed as inputs to the FakeQuantWithMinMaxVars operation, shape same as gradients. min, max: Quantization interval, floats of shape [d].  
  min   A Tensor of type float32.  
  max   A Tensor of type float32.  
  num_bits   An optional int. Defaults to 8. The bitwidth of the quantization; between 2 and 16, inclusive.  
  narrow_range   An optional bool. Defaults to False. Whether to quantize into 2^num_bits - 1 distinct values.  
  name   A name for the operation (optional).   
 


 Returns   A tuple of Tensor objects (backprops_wrt_input, backprop_wrt_min, backprop_wrt_max).     backprops_wrt_input   A Tensor of type float32.  
  backprop_wrt_min   A Tensor of type float32.  
  backprop_wrt_max   A Tensor of type float32.
tf.quantization.quantized_concat Concatenates quantized tensors along one dimension.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.quantization.quantized_concat, tf.compat.v1.quantized_concat  
tf.quantization.quantized_concat(
    concat_dim, values, input_mins, input_maxes, name=None
)

 


 Args
  concat_dim   A Tensor of type int32. 0-D. The dimension along which to concatenate. Must be in the range [0, rank(values)).  
  values   A list of at least 2 Tensor objects with the same type. The N Tensors to concatenate. Their ranks and types must match, and their sizes must match in all dimensions except concat_dim.  
  input_mins   A list with the same length as values of Tensor objects with type float32. The minimum scalar values for each of the input tensors.  
  input_maxes   A list with the same length as values of Tensor objects with type float32. The maximum scalar values for each of the input tensors.  
  name   A name for the operation (optional).   
 


 Returns   A tuple of Tensor objects (output, output_min, output_max).     output   A Tensor. Has the same type as values.  
  output_min   A Tensor of type float32.  
  output_max   A Tensor of type float32.
tf.quantization.quantize_and_dequantize     View source on GitHub    Quantizes then dequantizes a tensor. (deprecated)  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.quantization.quantize_and_dequantize  
tf.quantization.quantize_and_dequantize(
    input, input_min, input_max, signed_input=True, num_bits=8, range_given=False,
    round_mode='HALF_TO_EVEN', name=None, narrow_range=False, axis=None
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: This Op has been deprecated, usequantize_and_dequantize_v2 instead. To To simulate the V1 the behavior of tf.quantization.quantize_and_dequantize(...) use tf.grad_pass_through(tf.quantization.quantize_and_dequantize_v2)(...).
 


 Args
  input   A Tensor to quantize and dequantize.  
  input_min   If range_given=True, the minimum input value, that needs to be represented in the quantized representation. If axis is specified, this should be a vector of minimum values for each slice along axis.  
  input_max   If range_given=True, the maximum input value that needs to be represented in the quantized representation. If axis is specified, this should be a vector of maximum values for each slice along axis.  
  signed_input   True if the quantization is signed or unsigned.  
  num_bits   The bitwidth of the quantization.  
  range_given   If true use input_min and input_max for the range of the input, otherwise determine min and max from the input Tensor.  
  round_mode   Rounding mode when rounding from float values to quantized ones. one of ['HALF_TO_EVEN', 'HALF_UP']  
  name   Optional name for the operation.  
  narrow_range   If true, then the absolute value of the quantized minimum value is the same as the quantized maximum value, instead of 1 greater. i.e. for 8 bit quantization, the minimum value is -127 instead of -128.  
  axis   Integer. If specified, refers to a dimension of the input tensor, such that quantization will be per slice along that dimension.   
 


 Returns   A Tensor. Each element is the result of quantizing and dequantizing the corresponding element of input.
tf.quantization.quantize_and_dequantize_v2 Quantizes then dequantizes a tensor.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.quantization.quantize_and_dequantize_v2  
tf.quantization.quantize_and_dequantize_v2(
    input, input_min, input_max, signed_input=True, num_bits=8, range_given=False,
    round_mode='HALF_TO_EVEN', name=None, narrow_range=False, axis=None
)
 Updates the gradient definition for quantization that is outside the range to be 0.To simulate the V1 the behavior of tf.quantization.quantize_and_dequantize(...) use tf.grad_pass_through(tf.quantization.quantize_and_dequantize_v2)(...). Example usage: def getQuantizeOp(input):
    input_tensor = tf.placeholder(tf.float32, shape=[4, 4])
    net = tf.quantization.quantize_and_dequantize(input,
                                                  input_min=min_threshold,
                                                  input_max=max_threshold,
                                                  range_given=True)

To simulate v1 behavior:

def testDecomposeQuantizeDequantize(self):
    def f(input_tensor):
      return tf.quantization.quantize_and_dequantize_v2(input_tensor,
                                                        input_min = 5.0,
                                                        input_max= -10.0,
                                                        range_given=True)
    input_tensor = tf.placeholder(tf.float32, shape=[4, 4])
    net = tf.grad_pass_through(f)(input_tensor)

 


 Args
  input   A Tensor to quantize and dequantize.  
  input_min   If range_given=True, the minimum input value, that needs to be represented in the quantized representation. If axis is specified, this should be a vector of minimum values for each slice along axis.  
  input_max   If range_given=True, the maximum input value that needs to be represented in the quantized representation. If axis is specified, this should be a vector of maximum values for each slice along axis.  
  signed_input   True if the quantization is signed or unsigned.  
  num_bits   The bitwidth of the quantization.  
  range_given   If true use input_min and input_max for the range of the input, otherwise determine min and max from the input Tensor.  
  round_mode   Rounding mode when rounding from float values to quantized ones. one of ['HALF_TO_EVEN', 'HALF_UP']  
  name   Optional name for the operation.  
  narrow_range   If true, then the absolute value of the quantized minimum value is the same as the quantized maximum value, instead of 1 greater. i.e. for 8 bit quantization, the minimum value is -127 instead of -128.  
  axis   Integer. If specified, refers to a dimension of the input tensor, such that quantization will be per slice along that dimension.   
 


 Returns   A Tensor. Each element is the result of quantizing and dequantizing the corresponding element of input.
tf.quantize_and_dequantize_v4 Returns the gradient of QuantizeAndDequantizeV4.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.quantize_and_dequantize_v4  
tf.quantize_and_dequantize_v4(
    input, input_min, input_max, signed_input=True, num_bits=8, range_given=False,
    round_mode='HALF_TO_EVEN', narrow_range=False, axis=-1, name=None
)
 This is almost identical to QuantizeAndDequantizeV2, except that it returns a gradient of 1 for inputs that are within the quantization range, or 0 otherwise.
 


 Args
  input   A Tensor. Must be one of the following types: bfloat16, half, float32, float64.  
  input_min   A Tensor. Must have the same type as input.  
  input_max   A Tensor. Must have the same type as input.  
  signed_input   An optional bool. Defaults to True.  
  num_bits   An optional int. Defaults to 8.  
  range_given   An optional bool. Defaults to False.  
  round_mode   An optional string from: "HALF_TO_EVEN", "HALF_UP". Defaults to "HALF_TO_EVEN".  
  narrow_range   An optional bool. Defaults to False.  
  axis   An optional int. Defaults to -1.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor. Has the same type as input.
Module: tf.queue Public API for tf.queue namespace. Classes class FIFOQueue: A queue implementation that dequeues elements in first-in first-out order. class PaddingFIFOQueue: A FIFOQueue that supports batching variable-sized tensors by padding. class PriorityQueue: A queue implementation that dequeues elements in prioritized order. class QueueBase: Base class for queue implementations. class RandomShuffleQueue: A queue implementation that dequeues elements in a random order.