(item_scalar, converter)
return inputs, outputs, controls, lengths
TensorFlow op that converts item into output tensors.

  Sequences will be padded to match the length of the longest.

  Args:
    item_scalar: A scalar of type tf.String containing the raw item to be
      converted to tensors.
    converter: The DataConverter to be used.

  Returns:
    inputs: A Tensor, shaped [num encoded seqs, max(lengths), input_depth],
        containing the padded input encodings.
    outputs: A Tensor, shaped [num encoded seqs, max(lengths), output_depth],
        containing the padded output encodings resulting from the input.
    controls: A Tensor, shaped
        [num encoded seqs, max(lengths), control_depth], containing the padded
        control encodings.
    lengths: A tf.int32 Tensor, shaped [num encoded seqs], containing the
      unpadded lengths of the tensor sequences resulting from the input.
TensorFlow op that converts item into output tensors.
TensorFlow op that converts item into output tensors .
def convert_to_tensors_op(item_scalar, converter):
  """TensorFlow op that converts item into output tensors.

  Sequences will be padded to match the length of the longest.

  Args:
    item_scalar: A scalar of type tf.String containing the raw item to be
      converted to tensors.
    converter: The DataConverter to be used.

  Returns:
    inputs: A Tensor, shaped [num encoded seqs, max(lengths), input_depth],
        containing the padded input encodings.
    outputs: A Tensor, shaped [num encoded seqs, max(lengths), output_depth],
        containing the padded output encodings resulting from the input.
    controls: A Tensor, shaped
        [num encoded seqs, max(lengths), control_depth], containing the padded
        control encodings.
    lengths: A tf.int32 Tensor, shaped [num encoded seqs], containing the
      unpadded lengths of the tensor sequences resulting from the input.
  """

  def _convert_and_pad(item_str):
    item = converter.str_to_item_fn(item_str.numpy())  # pylint:disable=not-callable
    tensors = converter.to_tensors(item)
    inputs = _maybe_pad_seqs(tensors.inputs, converter.input_dtype,
                             converter.input_depth)
    outputs = _maybe_pad_seqs(tensors.outputs, converter.output_dtype,
                              converter.output_depth)
    controls = _maybe_pad_seqs(tensors.controls, converter.control_dtype,
                               converter.control_depth)
    return inputs, outputs, controls, np.array(tensors.lengths, np.int32)

  inputs, outputs, controls, lengths = tf.py_function(
      _convert_and_pad,
      inp=[item_scalar],
      Tout=[
          converter.input_dtype, converter.output_dtype,
          converter.control_dtype, tf.int32
      ],
      name='convert_and_pad')
  inputs.set_shape([None, None, converter.input_depth])
  outputs.set_shape([None, None, converter.output_depth])
  controls.set_shape([None, None, converter.control_depth])
  lengths.set_shape([None] + list(converter.length_shape))
  return inputs, outputs, controls, lengths
def convert_to_tensors_op ( item_scalar , converter ) : def _convert_and_pad ( item_str ) : item = converter . str_to_item_fn ( item_str . numpy ( ) ) # pylint:disable=not-callable tensors = converter . to_tensors ( item ) inputs = _maybe_pad_seqs ( tensors . inputs , converter . input_dtype , converter . input_depth ) outputs = _maybe_pad_seqs ( tensors . outputs , converter . output_dtype , converter . output_depth ) controls = _maybe_pad_seqs ( tensors . controls , converter . control_dtype , converter . control_depth ) return inputs , outputs , controls , np . array ( tensors . lengths , np . int32 ) inputs , outputs , controls , lengths = tf . py_function ( _convert_and_pad , inp = [ item_scalar ] , Tout = [ converter . input_dtype , converter . output_dtype , converter . control_dtype , tf . int32 ] , name = 'convert_and_pad' ) inputs . set_shape ( [ None , None , converter . input_depth ] ) outputs . set_shape ( [ None , None , converter . output_depth ] ) controls . set_shape ( [ None , None , converter . control_depth ] ) lengths . set_shape ( [ None ] + list ( converter . length_shape ) ) return inputs , outputs , controls , lengths