dimanche 30 mai 2021

Easiest way to random sampling from a multidimensional array with another multidimensional array in python

I have a 3d numpy array that looks like this

A = np.random.randin(0, 10, (23, 23, 39))        # H, W, D

And wish to random sample from its depth to reach a 2d array with H and W only

Note … this doesn't work

B = A[np.random.randint(0, 39, (23,23))]



Aucun commentaire:

Enregistrer un commentaire