def encode_value(self, string_list, values):
    """Encode the value of this feature into the CSV line."""

    if self._rank == 0:
      flattened_values = [values]
    elif self._rank == 1:
      # Short-circuit the reshaping logic needed for rank > 1.
      flattened_values = values
    else:
      flattened_values = np.asarray(values, dtype=self._np_dtype).reshape(-1)

    if len(flattened_values) != self._size:
      raise ValueError(
          'FixedLenFeature "{}" got wrong number of values. Expected {} but '
          'got {}'.format(self._name, self._size, len(flattened_values)))

    if self._encoder:
      string_list[self._index] = self._encoder.encode_record(flattened_values)
    else:
      string_list[self._index] = _to_string(flattened_values[0])
Encode the value of this feature into the CSV line.
tensorflow_transform/coders/csv_coder.py