Add numpy compatibility note to transpose operations.
authorMark Daoust <markdaoust@google.com>
Tue, 20 Feb 2018 19:13:55 +0000 (11:13 -0800)
committerTensorFlower Gardener <gardener@tensorflow.org>
Tue, 20 Feb 2018 19:27:48 +0000 (11:27 -0800)
fixes #15994

PiperOrigin-RevId: 186331307

tensorflow/python/ops/array_ops.py

index d63a9ea..2aa3ef0 100644 (file)
@@ -1390,6 +1390,14 @@ def transpose(a, perm=None, name="transpose", conjugate=False):
   `a.dtype` is either `complex64` or `complex128` then the values of `a`
   are conjugated and transposed.
 
+  @compatibility(numpy)
+  In `numpy` transposes are memory-efficient constant time operations as they
+  simply return a new view of the same data with adjusted `strides`.
+
+  TensorFlow does not support strides, so `transpose` returns a new tensor with
+  the items permuted.
+  @end_compatibility
+
   For example:
 
   ```python
@@ -1490,6 +1498,14 @@ def matrix_transpose(a, name="matrix_transpose", conjugate=False):
   tf.matmul(matrix, tf.matrix_transpose(b))
   ```
 
+  @compatibility(numpy)
+  In `numpy` transposes are memory-efficient constant time operations as they
+  simply return a new view of the same data with adjusted `strides`.
+
+  TensorFlow does not support strides, `matrix_transposes` return a new tensor
+  with the items permuted.
+  @end_compatibility
+
   Args:
     a: A `Tensor` with `rank >= 2`.
     name: A name for the operation (optional).