parameters: (value, new_partitions)
docstring: Updates `value` to use `new_partitions` as its (outer) row partitions.
  
    This is used to ensure that all fields in a `StructuredTensor` use identical
    `RowPartition` objects for the shared dimensions.  In particular,
    `StructuredTensor.from_fields` first merges all of the row partitions from
    any fields, and then replaces the outer row partitions of all fields with
    the merged row partitions (using this function).
  
    Args:
      value: A `Tensor`, `RaggedTensor`, or `StructuredTensor`.
      new_partitions: A list of row-partitions that should be used by `value`.
        Must be equivalent to `value`'s current row partitions.
  
    Returns:
      A value that is equivalent to `value`, where outer row partitions have been
      replaced by `new_partitions`.
docstring_summary: Updates `value` to use `new_partitions` as its (outer) row partitions.
docstring_tokens: Updates value to use new_partitions as its ( outer ) row partitions .
function: def _replace_row_partitions(value, new_partitions):
    """Updates `value` to use `new_partitions` as its (outer) row partitions.
  
    This is used to ensure that all fields in a `StructuredTensor` use identical
    `RowPartition` objects for the shared dimensions.  In particular,
    `StructuredTensor.from_fields` first merges all of the row partitions from
    any fields, and then replaces the outer row partitions of all fields with
    the merged row partitions (using this function).
  
    Args:
      value: A `Tensor`, `RaggedTensor`, or `StructuredTensor`.
      new_partitions: A list of row-partitions that should be used by `value`.
        Must be equivalent to `value`'s current row partitions.
  
    Returns:
      A value that is equivalent to `value`, where outer row partitions have been
      replaced by `new_partitions`.
    """
    if isinstance(value, ops.Tensor) or not new_partitions:
      return value
  
    elif isinstance(value, ragged_tensor.RaggedTensor):
      return ragged_tensor.RaggedTensor._from_row_partition(  # pylint: disable=protected-access
          values=_replace_row_partitions(value.values, new_partitions[1:]),
          row_partition=new_partitions[0])
  
    else:
      assert isinstance(value, StructuredTensor)
      new_fields = dict((k, _replace_row_partitions(v, new_partitions))
                        for (k, v) in value._fields.items())
      return StructuredTensor(
          fields=new_fields,
          shape=value.shape,
          nrows=value.nrows(),
          row_partitions=new_partitions +
          value.row_partitions[len(new_partitions):],
          internal=_structured_tensor_factory_key)
function_tokens: def _replace_row_partitions ( value , new_partitions ) : if isinstance ( value , ops . Tensor ) or not new_partitions : return value elif isinstance ( value , ragged_tensor . RaggedTensor ) : return ragged_tensor . RaggedTensor . _from_row_partition ( # pylint: disable=protected-access values = _replace_row_partitions ( value . values , new_partitions [ 1 : ] ) , row_partition = new_partitions [ 0 ] ) else : assert isinstance ( value , StructuredTensor ) new_fields = dict ( ( k , _replace_row_partitions ( v , new_partitions ) ) for ( k , v ) in value . _fields . items ( ) ) return StructuredTensor ( fields = new_fields , shape = value . shape , nrows = value . nrows ( ) , row_partitions = new_partitions + value . row_partitions [ len ( new_partitions ) : ] , internal = _structured_tensor_factory_key )