here is the output attached for the predict_and_sample exercise of assignment 3

```
(1, 90)
(90,)
np.argmax(results[12]) = 0
np.argmax(results[17]) = 0
list(indices[12:18]) = [0, 0, 0, 0, 0, 0]
```

could anyone please resolve why I am getting all zeros

here is the output attached for the predict_and_sample exercise of assignment 3

```
(1, 90)
(90,)
np.argmax(results[12]) = 0
np.argmax(results[17]) = 0
list(indices[12:18]) = [0, 0, 0, 0, 0, 0]
```

could anyone please resolve why I am getting all zeros

Which week in Course 5? (Iâ€™m going to assume it is Week 1).

Since your values for â€śindicesâ€ť are wrong, I suspect there is an error in your code for the indices.

What axis argument did you use there?

indices = np.argmax(pred,axis = 0)

this is the indices part

axis = 0 is wrong. Try axis = -1.

1 Like

Earlier I tried axis=-1 but it showed an error

axis=-1 is correct.

If you got an error, itâ€™s because of some other problem in your code.

SIR shall I dm you the code??

if yes please specify which partâ€¦

Just post your code here for the function that has the np.argmax() statement in it.

sir here is the code

```
indices = np.argmax(pred,axis = -1)
```

and this is the error displayed

```
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-22-e3fa72710400> in <module>
1 results, indices = predict_and_sample(inference_model, x_initializer, a_initializer, c_initializer)
2
----> 3 print("np.argmax(results[12]) =", np.argmax(results[12]))
4 print("np.argmax(results[17]) =", np.argmax(results[17]))
5 print("list(indices[12:18]) =", list(indices[12:18]))
IndexError: index 12 is out of bounds for axis 0 with size 1
```

1 Like

Sir please explain the error I am unable to figure it out

Iâ€™m getting a different error for the same code:- indices = np.argmax(pred,axis = -1)

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Iâ€™m already monitoring the thread. You donâ€™t need to ping me specifically.

Which week and assignment number?

Which function?

The Week 1 Jazz Assignment, in the predict and sample function

Perhaps your â€śpredâ€ť values are not correct.

It would help if you post the entire error stack including the assert message.