def _get_bytes(tensor):
  """Get tensor size in bytes.

  Args:
    tensor: Tensor: A input tensor.

  Returns:
    Size in bytes.
  """
  tensor_size = tensor.get_shape().num_elements() or 0
  return tensor_size * tensor.dtype.size