Skip to content

Instantly share code, notes, and snippets.

@dohaivu
Last active August 14, 2017 01:07
Show Gist options
  • Save dohaivu/545e916f46f6b5e94791fb26002ee7cc to your computer and use it in GitHub Desktop.
Save dohaivu/545e916f46f6b5e94791fb26002ee7cc to your computer and use it in GitHub Desktop.
[numpy] shape #python

Links

https://stackoverflow.com/questions/22053050/difference-between-numpy-array-shape-r-1-and-r

Array

Numpy arrays are not vectors. Or matrices for that matters. They're arrays.

They can be used to represent vectors, matrices, tensors or anything you want. The genius of numpy however is to represent arrays, and let the user decide on their meaning.

It is a table of elements (usually numbers), all of the same type, indexed by a tuple of positive integers. In NumPy dimensions are called axes. The number of axes is rank.

termwise multiplication:
broadcasting: duplicate row or column

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment