I have x0 which is a float64 (64,64) array. Whenever I try this:
delta = np.random.randn(x0.shape)
It gives the captioned error. This is so basic that I'm wrapping my heads around it. What am I missing out? Thanks
The complete traceback is as follows:
Traceback (most recent call last):
File "<ipython-input-31-dcd2365ed519>", line 1, in <module>
delta = np.random.randn(x0.shape)
File "mtrand.pyx", line 1420, in mtrand.RandomState.randn
File "mtrand.pyx", line 1550, in mtrand.RandomState.standard_normal
File "mtrand.pyx", line 167, in mtrand.cont0_array
TypeError: 'tuple' object cannot be interpreted as an integer
np.random.randn() requires integer arguments, in the form randn(64,64). You are giving np.random.randn() arguments in the form randn((64,64)), which it is not expecting. Instead, if you want to build a 64x64 random array, you will need to pass the number of rows and columns individually, not as a tuple.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With