# Assertion \`t \>= 0 && t \< n\_classes\` failed error

**URL:** <https://discuss.pytorch.org/t/assertion-t-0-t-n-classes-failed-error/133794>\
**Category:** vision\
**Created:** [October 9, 2021, 7:46am UTC](https://discuss.pytorch.org/t/assertion-t-0-t-n-classes-failed-error/133794 "2021-10-09T07:46:00Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![James\_Lee](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/james_lee/32/29487_2.png) [@James\_Lee](https://discuss.pytorch.org/u/James_Lee)\
**Post date:** [October 9, 2021, 10:59am UTC](https://discuss.pytorch.org/t/assertion-t-0-t-n-classes-failed-error/133794/3 "2021-10-09T10:59:33Z")

</div>

After `print(target.min(), target.max())` ,I got target.min() == 0 rather than -1 I expected. I set the label pixel value to -1 follow your advice here [Got RuntimeError: Boolean value of Tensor with more than one value is ambiguous during training - #2 by ptrblck](https://discuss.pytorch.org/t/got-runtimeerror-boolean-value-of-tensor-with-more-than-one-value-is-ambiguous-during-training/133762/2) , but it seemed this did not work as I expected? Could you please give me any clues? Many thanks.

---

_[View the full topic](https://discuss.pytorch.org/t/assertion-t-0-t-n-classes-failed-error/133794)._
