def _pad_shallow_tensors(tensors, pad_value):
  """Pads the shorter tensors to be as long as the longest."""
  max_dim = 0
  for tensor in tensors:
    dim = tensor.shape.as_list()[-1]
    if dim > max_dim:
      max_dim = dim

  output_tensors = []
  for tensor in tensors:
    dim = tensor.shape.as_list()[-1]
    if tensor.shape.as_list()[-1] < max_dim:
      output_tensors.append(
          tf.pad(
              tensor, [[0, 0], [0, 0], [0, max_dim - dim]],
              constant_values=pad_value))
    else:
      output_tensors.append(tensor)
  print(output_tensors)

  return output_tensors
Pads the shorter tensors to be as long as the longest.
tensor2tensor/models/neural_architecture_search/nas_model.py