import numpy as np
x1 = np.arange(0,63, dtype=np.int8).reshape(63,1)
x2 = np.arange(0,63, dtype=np.int8).reshape(1,63)
o = np.zeros((63,63), dtype=np.int16)
o = np.matmul(x1,x2)
print(o)
Output:
[[ 0 0 0 ... 0 0 0]
[ 0 1 2 ... 60 61 62]
[ 0 2 4 ... 120 122 124]
...
[ 0 60 120 ... 16 76 -120]
[ 0 61 122 ... 76 -119 -58]
[ 0 62 124 ... -120 -58 4]]
The value of x1 and x2 are within the range of np.int8 after np.matmul operation the value is above the int8 range so I am storing it into int16, still I am getting incorrect values. Can someone please explain me why is this happening? Thanks