I am using np.random.rand to create a matrix/tensor of the desired shape. However, this shape argument (generated in runtime) is a tuple such as: (2, 3, 4). How can we use this shape in np.random.rand?
Doing np.random.rand(shape) doesn't work and would give the following error:
TypeError: 'tuple' object cannot be interpreted as an index
Aucun commentaire:
Enregistrer un commentaire