# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: 'Python 3.8.5 64-bit (''env'': venv)'
#     name: python_defaultSpec_1599703934604
# ---

# Simple tip to avoid problems with data structures due to the broadcasting features in numpy/python

# +
import numpy as np

a = np.random.randn(5) # rank 1 array

# + tags=[]
print(a)

# + tags=[]
print(a.shape)

# + tags=[]
print(a.T) # bad!

# + tags=[]
print(a @ a.T)

# + tags=[]
a = np.random.randn(5,1)
print(a)

# + tags=[]
print(a.T)

# + tags=[]
print(a @ a.T)

StarcoderdataJupyterScriptsDedupFiltered