neulab/docprompting-conala huggingface dataset:
tf.strings.unicode_split     View source on GitHub    Splits each string in input into a sequence of Unicode code points.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.strings.unicode_split  
tf.strings.unicode_split(
    input, input_encoding, errors='replace', replacement_char=65533,
    name=None
)
 result[i1...iN, j] is the substring of input[i1...iN] that encodes its jth character, when decoded using input_encoding.
 


 Args
  input   An N dimensional potentially ragged string tensor with shape [D1...DN]. N must be statically known.  
  input_encoding   String name for the unicode encoding that should be used to decode each string.  
  errors   Specifies the response when an input string can't be converted using the indicated encoding. One of:  
'strict': Raise an exception for any illegal substrings. 
'replace': Replace illegal substrings with replacement_char. 
'ignore': Skip illegal substrings. 

 
  replacement_char   The replacement codepoint to be used in place of invalid substrings in input when errors='replace'.  
  name   A name for the operation (optional).   
 


 Returns   A N+1 dimensional int32 tensor with shape [D1...DN, (num_chars)]. The returned tensor is a tf.Tensor if input is a scalar, or a tf.RaggedTensor otherwise.  
 Example: 
input = [s.encode('utf8') for s in (u'G\xf6\xf6dnight', u'\U0001f60a')]
tf.strings.unicode_split(input, 'UTF-8').to_list()
[[b'G', b'\xc3\xb6', b'\xc3\xb6', b'd', b'n', b'i', b'g', b'h', b't'],
 [b'\xf0\x9f\x98\x8a']]
tf.strings.unicode_split_with_offsets     View source on GitHub    Splits each string into a sequence of code points with start offsets.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.strings.unicode_split_with_offsets  
tf.strings.unicode_split_with_offsets(
    input, input_encoding, errors='replace', replacement_char=65533,
    name=None
)
 This op is similar to tf.strings.decode(...), but it also returns the start offset for each character in its respective string. This information can be used to align the characters with the original byte sequence. Returns a tuple (chars, start_offsets) where:  
chars[i1...iN, j] is the substring of input[i1...iN] that encodes its jth character, when decoded using input_encoding. 
start_offsets[i1...iN, j] is the start byte offset for the jth character in input[i1...iN], when decoded using input_encoding. 
 


 Args
  input   An N dimensional potentially ragged string tensor with shape [D1...DN]. N must be statically known.  
  input_encoding   String name for the unicode encoding that should be used to decode each string.  
  errors   Specifies the response when an input string can't be converted using the indicated encoding. One of:  
'strict': Raise an exception for any illegal substrings. 
'replace': Replace illegal substrings with replacement_char. 
'ignore': Skip illegal substrings. 

 
  replacement_char   The replacement codepoint to be used in place of invalid substrings in input when errors='replace'.  
  name   A name for the operation (optional).   
 


 Returns   A tuple of N+1 dimensional tensors (codepoints, start_offsets).  
codepoints is an int32 tensor with shape [D1...DN, (num_chars)]. 
offsets is an int64 tensor with shape [D1...DN, (num_chars)].  The returned tensors are tf.Tensors if input is a scalar, or tf.RaggedTensors otherwise. 
 
 Example: 
input = [s.encode('utf8') for s in (u'G\xf6\xf6dnight', u'\U0001f60a')]
result = tf.strings.unicode_split_with_offsets(input, 'UTF-8')
result[0].to_list()  # character substrings
[[b'G', b'\xc3\xb6', b'\xc3\xb6', b'd', b'n', b'i', b'g', b'h', b't'],
 [b'\xf0\x9f\x98\x8a']]
result[1].to_list()  # offsets
[[0, 1, 3, 5, 6, 7, 8, 9, 10], [0]]
tf.strings.unsorted_segment_join Joins the elements of inputs based on segment_ids.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.strings.unsorted_segment_join  
tf.strings.unsorted_segment_join(
    inputs, segment_ids, num_segments, separator='', name=None
)
 Computes the string join along segments of a tensor. Given segment_ids with rank N and data with rank N+M: `output[i, k1...kM] = strings.join([data[j1...jN, k1...kM])`
 where the join is over all [j1...jN] such that segment_ids[j1...jN] = i. Strings are joined in row-major order. For example: inputs = [['Y', 'q', 'c'], ['Y', '6', '6'], ['p', 'G', 'a']]
output_array = string_ops.unsorted_segment_join(inputs=inputs,
                                                segment_ids=[1, 0, 1],
                                                num_segments=2,
                                                separator=':'))
# output_array ==> [['Y', '6', '6'], ['Y:p', 'q:G', 'c:a']]


inputs = ['this', 'is', 'a', 'test']
output_array = string_ops.unsorted_segment_join(inputs=inputs,
                                                segment_ids=[0, 0, 0, 0],
                                                num_segments=1,
                                                separator=':'))
# output_array ==> ['this:is:a:test']

 


 Args
  inputs   A Tensor of type string. The input to be joined.  
  segment_ids   A Tensor. Must be one of the following types: int32, int64. A tensor whose shape is a prefix of data.shape. Negative segment ids are not supported.  
  num_segments   A Tensor. Must be one of the following types: int32, int64. A scalar.  
  separator   An optional string. Defaults to "". The separator to use when joining.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor of type string.
tf.strings.upper Converts all lowercase characters into their respective uppercase replacements.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.strings.upper  
tf.strings.upper(
    input, encoding='', name=None
)
 Example: 
tf.strings.upper("CamelCase string and ALL CAPS")
<tf.Tensor: shape=(), dtype=string, numpy=b'CAMELCASE STRING AND ALL CAPS'>

 


 Args
  input   A Tensor of type string.  
  encoding   An optional string. Defaults to "".  
  name   A name for the operation (optional).   
 


 Returns   A Tensor of type string.
Module: tf.summary     View source on GitHub    Operations for writing summary data, for use in analysis and visualization. The tf.summary module provides APIs for writing summary data. This data can be visualized in TensorBoard, the visualization toolkit that comes with TensorFlow. See the TensorBoard website for more detailed tutorials about how to use these APIs, or some quick examples below. Example usage with eager execution, the default in TF 2.0: writer = tf.summary.create_file_writer("/tmp/mylogs")
with writer.as_default():
  for step in range(100):
    # other model code would go here
    tf.summary.scalar("my_metric", 0.5, step=step)
    writer.flush()
 Example usage with tf.function graph execution: writer = tf.summary.create_file_writer("/tmp/mylogs")

@tf.function
def my_func(step):
  # other model code would go here
  with writer.as_default():
    tf.summary.scalar("my_metric", 0.5, step=step)

for step in range(100):
  my_func(step)
  writer.flush()
 Example usage with legacy TF 1.x graph execution: with tf.compat.v1.Graph().as_default():
  step = tf.Variable(0, dtype=tf.int64)
  step_update = step.assign_add(1)
  writer = tf.summary.create_file_writer("/tmp/mylogs")
  with writer.as_default():
    tf.summary.scalar("my_metric", 0.5, step=step)
  all_summary_ops = tf.compat.v1.summary.all_v2_summary_ops()
  writer_flush = writer.flush()

  sess = tf.compat.v1.Session()
  sess.run([writer.init(), step.initializer])
  for i in range(100):
    sess.run(all_summary_ops)
    sess.run(step_update)
    sess.run(writer_flush)
 Modules experimental module: Public API for tf.summary.experimental namespace. Classes class SummaryWriter: Interface representing a stateful summary writer object. Functions audio(...): Write an audio summary. create_file_writer(...): Creates a summary file writer for the given log directory. create_noop_writer(...): Returns a summary writer that does nothing. flush(...): Forces summary writer to send any buffered data to storage. histogram(...): Write a histogram summary. image(...): Write an image summary. record_if(...): Sets summary recording on or off per the provided boolean value. scalar(...): Write a scalar summary. should_record_summaries(...): Returns boolean Tensor which is true if summaries should be recorded. text(...): Write a text summary. trace_export(...): Stops and exports the active trace as a Summary and/or profile file. trace_off(...): Stops the current trace and discards any collected information. trace_on(...): Starts a trace to record computation graphs and profiling information. write(...): Writes a generic summary to the default SummaryWriter if one exists.
tf.summary.audio     View source on GitHub    Write an audio summary. 
tf.summary.audio(
    name, data, sample_rate, step=None, max_outputs=3, encoding=None,
    description=None
)

 


 Arguments
  name   A name for this summary. The summary tag used for TensorBoard will be this name prefixed by any active name scopes.  
  data   A Tensor representing audio data with shape [k, t, c], where k is the number of audio clips, t is the number of frames, and c is the number of channels. Elements should be floating-point values in [-1.0, 1.0]. Any of the dimensions may be statically unknown (i.e., None).  
  sample_rate   An int or rank-0 int32 Tensor that represents the sample rate, in Hz. Must be positive.  
  step   Explicit int64-castable monotonic step value for this summary. If omitted, this defaults to tf.summary.experimental.get_step(), which must not be None.  
  max_outputs   Optional int or rank-0 integer Tensor. At most this many audio clips will be emitted at each step. When more than max_outputs many clips are provided, the first max_outputs many clips will be used and the rest silently discarded.  
  encoding   Optional constant str for the desired encoding. Only "wav" is currently supported, but this is not guaranteed to remain the default, so if you want "wav" in particular, set this explicitly.  
  description   Optional long-form description for this summary, as a constant str. Markdown is supported. Defaults to empty.   
 


 Returns   True on success, or false if no summary was emitted because no default summary writer was available.  

 


 Raises
  ValueError   if a default writer exists, but no step was provided and tf.summary.experimental.get_step() is None.
tf.summary.create_file_writer Creates a summary file writer for the given log directory. 
tf.summary.create_file_writer(
    logdir, max_queue=None, flush_millis=None, filename_suffix=None, name=None
)

 


 Args
  logdir   a string specifying the directory in which to write an event file.  
  max_queue   the largest number of summaries to keep in a queue; will flush once the queue gets bigger than this. Defaults to 10.  
  flush_millis   the largest interval between flushes. Defaults to 120,000.  
  filename_suffix   optional suffix for the event file name. Defaults to .v2.  
  name   a name for the op that creates the writer.   
 


 Returns   A SummaryWriter object.
tf.summary.create_noop_writer Returns a summary writer that does nothing. 
tf.summary.create_noop_writer()
 This is useful as a placeholder in code that expects a context manager.
Module: tf.summary.experimental Public API for tf.summary.experimental namespace. Functions get_step(...): Returns the default summary step for the current thread. set_step(...): Sets the default summary step for the current thread. summary_scope(...): Experimental context manager for use when defining a custom summary op. write_raw_pb(...): Writes a summary using raw tf.compat.v1.Summary protocol buffers.
tf.summary.experimental.get_step Returns the default summary step for the current thread. 
tf.summary.experimental.get_step()

 


 Returns   The step set by tf.summary.experimental.set_step() if one has been set, otherwise None.
tf.summary.experimental.set_step Sets the default summary step for the current thread. 
tf.summary.experimental.set_step(
    step
)
 For convenience, this function sets a default value for the step parameter used in summary-writing functions elsewhere in the API so that it need not be explicitly passed in every such invocation. The value can be a constant or a variable, and can be retrieved via tf.summary.experimental.get_step(). 
Note: when using this with @tf.functions, the step value will be captured at the time the function is traced, so changes to the step outside the function will not be reflected inside the function unless using a tf.Variable step.

 


 Args
  step   An int64-castable default step value, or None to unset.
tf.summary.experimental.summary_scope Experimental context manager for use when defining a custom summary op. 
@tf_contextlib.contextmanager
tf.summary.experimental.summary_scope(
    name, default_name='summary', values=None
)
 This behaves similarly to tf.name_scope, except that it returns a generated summary tag in addition to the scope name. The tag is structurally similar to the scope name - derived from the user-provided name, prefixed with enclosing name scopes if any - but we relax the constraint that it be uniquified, as well as the character set limitation (so the user-provided name can contain characters not legal for scope names; in the scope name these are removed). This makes the summary tag more predictable and consistent for the user. For example, to define a new summary op called my_op: def my_op(name, my_value, step):
  with tf.summary.summary_scope(name, "MyOp", [my_value]) as (tag, scope):
    my_value = tf.convert_to_tensor(my_value)
    return tf.summary.write(tag, my_value, step=step)

 


 Args
  name   string name for the summary.  
  default_name   Optional; if provided, used as default name of the summary.  
  values   Optional; passed as values parameter to name_scope.   
 


 Yields   A tuple (tag, scope) as described above.
tf.summary.experimental.write_raw_pb Writes a summary using raw tf.compat.v1.Summary protocol buffers. 
tf.summary.experimental.write_raw_pb(
    tensor, step=None, name=None
)
 Experimental: this exists to support the usage of V1-style manual summary writing (via the construction of a tf.compat.v1.Summary protocol buffer) with the V2 summary writing API.
 


 Args
  tensor   the string Tensor holding one or more serialized Summary protobufs  
  step   Explicit int64-castable monotonic step value for this summary. If omitted, this defaults to tf.summary.experimental.get_step(), which must not be None.  
  name   Optional string name for this op.   
 


 Returns   True on success, or false if no summary was written because no default summary writer was available.  

 


 Raises
  ValueError   if a default writer exists, but no step was provided and tf.summary.experimental.get_step() is None.
tf.summary.flush Forces summary writer to send any buffered data to storage. 
tf.summary.flush(
    writer=None, name=None
)
 This operation blocks until that finishes.
 


 Args
  writer   The tf.summary.SummaryWriter resource to flush. The thread default will be used if this parameter is None. Otherwise a tf.no_op is returned.  
  name   A name for the operation (optional).   
 


 Returns   The created tf.Operation.
tf.summary.histogram     View source on GitHub    Write a histogram summary. 
tf.summary.histogram(
    name, data, step=None, buckets=None, description=None
)

 


 Arguments
  name   A name for this summary. The summary tag used for TensorBoard will be this name prefixed by any active name scopes.  
  data   A Tensor of any shape. Must be castable to float64.  
  step   Explicit int64-castable monotonic step value for this summary. If omitted, this defaults to tf.summary.experimental.get_step(), which must not be None.  
  buckets   Optional positive int. The output will have this many buckets, except in two edge cases. If there is no data, then there are no buckets. If there is data but all points have the same value, then there is one bucket whose left and right endpoints are the same.  
  description   Optional long-form description for this summary, as a constant str. Markdown is supported. Defaults to empty.   
 


 Returns   True on success, or false if no summary was emitted because no default summary writer was available.  

 


 Raises
  ValueError   if a default writer exists, but no step was provided and tf.summary.experimental.get_step() is None.
tf.summary.image     View source on GitHub    Write an image summary. 
tf.summary.image(
    name, data, step=None, max_outputs=3, description=None
)

 


 Arguments
  name   A name for this summary. The summary tag used for TensorBoard will be this name prefixed by any active name scopes.  
  data   A Tensor representing pixel data with shape [k, h, w, c], where k is the number of images, h and w are the height and width of the images, and c is the number of channels, which should be 1, 2, 3, or 4 (grayscale, grayscale with alpha, RGB, RGBA). Any of the dimensions may be statically unknown (i.e., None). Floating point data will be clipped to the range [0,1).  
  step   Explicit int64-castable monotonic step value for this summary. If omitted, this defaults to tf.summary.experimental.get_step(), which must not be None.  
  max_outputs   Optional int or rank-0 integer Tensor. At most this many images will be emitted at each step. When more than max_outputs many images are provided, the first max_outputs many images will be used and the rest silently discarded.  
  description   Optional long-form description for this summary, as a constant str. Markdown is supported. Defaults to empty.   
 


 Returns   True on success, or false if no summary was emitted because no default summary writer was available.  

 


 Raises
  ValueError   if a default writer exists, but no step was provided and tf.summary.experimental.get_step() is None.
tf.summary.record_if Sets summary recording on or off per the provided boolean value. 
@tf_contextlib.contextmanager
tf.summary.record_if(
    condition
)
 The provided value can be a python boolean, a scalar boolean Tensor, or or a callable providing such a value; if a callable is passed it will be invoked on-demand to determine whether summary writing will occur.
 


 Args
  condition   can be True, False, a bool Tensor, or a callable providing such.   
 


 Yields   Returns a context manager that sets this value on enter and restores the previous value on exit.
tf.summary.scalar     View source on GitHub    Write a scalar summary. 
tf.summary.scalar(
    name, data, step=None, description=None
)

 


 Arguments
  name   A name for this summary. The summary tag used for TensorBoard will be this name prefixed by any active name scopes.  
  data   A real numeric scalar value, convertible to a float32 Tensor.  
  step   Explicit int64-castable monotonic step value for this summary. If omitted, this defaults to tf.summary.experimental.get_step(), which must not be None.  
  description   Optional long-form description for this summary, as a constant str. Markdown is supported. Defaults to empty.   
 


 Returns   True on success, or false if no summary was written because no default summary writer was available.  

 


 Raises
  ValueError   if a default writer exists, but no step was provided and tf.summary.experimental.get_step() is None.
tf.summary.should_record_summaries Returns boolean Tensor which is true if summaries should be recorded. 
tf.summary.should_record_summaries()
tf.summary.SummaryWriter Interface representing a stateful summary writer object. Methods as_default View source 
@abc.abstractmethod
@tf_contextlib.contextmanager
as_default(
    step=None
)
 Returns a context manager that enables summary writing. For convenience, if step is not None, this function also sets a default value for the step parameter used in summary-writing functions elsewhere in the API so that it need not be explicitly passed in every such invocation. The value can be a constant or a variable. 
Note: when setting step in a @tf.function, the step value will be captured at the time the function is traced, so changes to the step outside the function will not be reflected inside the function unless using a tf.Variable step.
 For example, step can be used as: with writer_a.as_default(step=10):
  tf.summary.scalar(tag, value)   # Logged to writer_a with step 10
  with writer_b.as_default(step=20):
    tf.summary.scalar(tag, value) # Logged to writer_b with step 20
  tf.summary.scalar(tag, value)   # Logged to writer_a with step 10

 


 Args
  step   An int64-castable default step value, or None. When not None, the current step is captured, replaced by a given one, and the original one is restored when the context manager exits. When None, the current step is not modified (and not restored when the context manager exits).    close View source 
close()
 Flushes and closes the summary writer. flush View source 
flush()
 Flushes any buffered data. init View source 
init()
 Initializes the summary writer. set_as_default View source 
@abc.abstractmethod
set_as_default(
    step=None
)
 Enables this summary writer for the current thread. For convenience, if step is not None, this function also sets a default value for the step parameter used in summary-writing functions elsewhere in the API so that it need not be explicitly passed in every such invocation. The value can be a constant or a variable. 
Note: when setting step in a @tf.function, the step value will be captured at the time the function is traced, so changes to the step outside the function will not be reflected inside the function unless using a tf.Variable step.

 


 Args
  step   An int64-castable default step value, or None. When not None, the current step is modified to the given value. When None, the current step is not modified.
tf.summary.text     View source on GitHub    Write a text summary. 
tf.summary.text(
    name, data, step=None, description=None
)

 


 Arguments
  name   A name for this summary. The summary tag used for TensorBoard will be this name prefixed by any active name scopes.  
  data   A UTF-8 string tensor value.  
  step   Explicit int64-castable monotonic step value for this summary. If omitted, this defaults to tf.summary.experimental.get_step(), which must not be None.  
  description   Optional long-form description for this summary, as a constant str. Markdown is supported. Defaults to empty.   
 


 Returns   True on success, or false if no summary was emitted because no default summary writer was available.  

 


 Raises
  ValueError   if a default writer exists, but no step was provided and tf.summary.experimental.get_step() is None.
tf.summary.trace_export Stops and exports the active trace as a Summary and/or profile file. 
tf.summary.trace_export(
    name, step=None, profiler_outdir=None
)
 Stops the trace and exports all metadata collected during the trace to the default SummaryWriter, if one has been set.
 


 Args
  name   A name for the summary to be written.  
  step   Explicit int64-castable monotonic step value for this summary. If omitted, this defaults to tf.summary.experimental.get_step(), which must not be None.  
  profiler_outdir   Output directory for profiler. This is only used when the profiler was enabled when the trace was started. In that case, if there is a logdir-based default SummaryWriter, this defaults to the same directory, but otherwise the argument must be passed.   
 


 Raises
  ValueError   if a default writer exists, but no step was provided and tf.summary.experimental.get_step() is None.
tf.summary.trace_off Stops the current trace and discards any collected information. 
tf.summary.trace_off()