diff options
author | Matti Picus <matti.picus@gmail.com> | 2018-08-08 09:31:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-08 09:31:58 -0700 |
commit | 8bd8a63383a4891c570ae6785af92f7d68d67d34 (patch) | |
tree | 7edefca638d7b75e7d59e446b8ebf571ba15a638 | |
parent | 77a86c949a3d8405731f1ff3e13e665593d329fc (diff) | |
parent | 2e8ac9c9c1179ea7a5bea9faf5ab23a93c6f749f (diff) | |
download | numpy-8bd8a63383a4891c570ae6785af92f7d68d67d34.tar.gz |
Merge pull request #11688 from tgsmith61591/update-broadcast-doc
DOC: Update broadcasting doc with current exception details
-rw-r--r-- | numpy/doc/broadcasting.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/numpy/doc/broadcasting.py b/numpy/doc/broadcasting.py index 1dc4f60bf..6c3a4bc75 100644 --- a/numpy/doc/broadcasting.py +++ b/numpy/doc/broadcasting.py @@ -53,9 +53,10 @@ dimensions are compatible when 2) one of them is 1 If these conditions are not met, a -``ValueError: frames are not aligned`` exception is thrown, indicating that -the arrays have incompatible shapes. The size of the resulting array -is the maximum size along each dimension of the input arrays. +``ValueError: operands could not be broadcast together`` exception is +thrown, indicating that the arrays have incompatible shapes. The size of +the resulting array is the maximum size along each dimension of the input +arrays. Arrays do not need to have the same *number* of dimensions. For example, if you have a ``256x256x3`` array of RGB values, and you want to scale @@ -124,7 +125,7 @@ An example of broadcasting in practice:: (5,) >>> x + y - <type 'exceptions.ValueError'>: shape mismatch: objects cannot be broadcast to a single shape + ValueError: operands could not be broadcast together with shapes (4,) (5,) >>> xx.shape (4, 1) |