def preprocess_record_impl(self, params, record):
    'Clips the l2 norm, returning the clipped record and the l2 norm.\n\n    Args:\n      params: The parameters for the sample.\n      record: The record to be processed.\n\n    Returns:\n      A tuple (preprocessed_records, l2_norm) where `preprocessed_records` is\n        the structure of preprocessed tensors, and l2_norm is the total l2 norm\n        before clipping.\n    '
    l2_norm_clip = params
    record_as_list = tf.nest.flatten(record)
    (clipped_as_list, norm) = tf.clip_by_global_norm(record_as_list, l2_norm_clip)
    return (tf.nest.pack_sequence_as(record, clipped_as_list), norm)
Clips the l2 norm, returning the clipped record and the l2 norm.

Args:
  params: The parameters for the sample.
  record: The record to be processed.

Returns:
  A tuple (preprocessed_records, l2_norm) where `preprocessed_records` is
    the structure of preprocessed tensors, and l2_norm is the total l2 norm
    before clipping.
def preprocess_record_impl(self, params, record):
    'Clips the l2 norm, returning the clipped record and the l2 norm.\n\n    Args:\n      params: The parameters for the sample.\n      record: The record to be processed.\n\n    Returns:\n      A tuple (preprocessed_records, l2_norm) where `preprocessed_records` is\n        the structure of preprocessed tensors, and l2_norm is the total l2 norm\n        before clipping.\n    '
    l2_norm_clip = params
    record_as_list = tf.nest.flatten(record)
    (clipped_as_list, norm) = tf.clip_by_global_norm(record_as_list, l2_norm_clip)
    return (tf.nest.pack_sequence_as(record, clipped_as_list), norm)