Browse Source

NumPy

pull/23/head
Jure Šorn 5 years ago
parent
commit
3740af894e
1 changed files with 4 additions and 4 deletions
  1. 8
      README.md

8
README.md

@ -1911,14 +1911,14 @@ indexes = <array>.argmin(axis)
**Broadcasting is a set of rules by which NumPy functions operate on arrays of different sizes and/or dimensions.** **Broadcasting is a set of rules by which NumPy functions operate on arrays of different sizes and/or dimensions.**
```python ```python
left = [[0.1], [0.6], [0.8]] # Shape: (3, 1)
right = [ 0.1 , 0.6 , 0.8 ] # Shape: (3)
left = [[0.1], [0.6], [0.8]] # Shape: (3, 1)
right = [ 0.1 , 0.6 , 0.8 ] # Shape: (3)
``` ```
#### 1. If array shapes differ in length, left-pad the smaller shape with ones: #### 1. If array shapes differ in length, left-pad the smaller shape with ones:
```python ```python
left = [[0.1], [0.6], [0.8]] # Shape: (3, 1)
right = [[0.1 , 0.6 , 0.8]] # Shape: (1, 3) <- !
left = [[0.1], [0.6], [0.8]] # Shape: (3, 1)
right = [[0.1 , 0.6 , 0.8]] # Shape: (1, 3) <- !
``` ```
#### 2. If any dimensions differ in size, expand the ones that have size 1 by duplicating their elements: #### 2. If any dimensions differ in size, expand the ones that have size 1 by duplicating their elements:

Loading…
Cancel
Save