1

I have tensor named y, which has values from one-hot encoding over class labels: y = [[ 0. 0. 1. ..., 0. 0. 0.],[ 1. 0. 0. ..., 0. 0. 0.],[ 0. 0. 0. ..., 0. 1. 0.], ...,[ 0. 0. 0. ..., 0. 0. 0.],[ 0. 0. 0. ..., 0. 0. 1.],[ 0. 0. 1. ..., 0. 0. 0.]] so here first row has third element as '1' so it represents class label for that image. Am trying to get all class labels from the given one-hot encoded array, or the given example it should be something like this: y = [2,0,8,...,9,2]

nikit lonari
  • 11
  • 1
  • 2

1 Answers1

0

I think the simplest way is:

import numpy as np
y = np.argmax(y)