message: performance optimizations on tf.transpose
  Instead of calling convert_to_tensor directly, we check the shape first, only call convert_to_tensor if the shape can not be obtained.
  This significantly helps with variable transpose (by ~40% faster) .
diff: @@ -1938,12 +1938,13 @@ def transpose(a, perm=None, name="transpose", conjugate=False):
  gen_array_ops.conjugate_transpose if
  (conjugate and a.dtype.is_complex) else gen_array_ops.transpose)
  if perm is None:
  + if not tensor_util.is_tensor(a):
  a = ops.convert_to_tensor(a, name="a")
  - if not a.get_shape().ndims:
  + if a.shape.ndims is None:
  rank = gen_array_ops.rank(a)
  perm = (rank - 1) - gen_math_ops._range(0, rank, 1)
  else:
  - rank = a.get_shape().ndims
  + rank = a.shape.ndims
  perm = (rank - 1) - np.arange(rank)
  ret = transpose_fn(a, perm, name=name)
  # NOTE(mrry): Setting the shape explicitly because
  