# 1only batches of spatial targets supported (non-empty 3D tensors) but got targets of size: : \[1, 3, 375, 1242\]

**URL:** <https://discuss.pytorch.org/t/1only-batches-of-spatial-targets-supported-non-empty-3d-tensors-but-got-targets-of-size-1-3-375-1242/32609>\
**Category:** vision\
**Created:** [December 20, 2018, 1:37am UTC](https://discuss.pytorch.org/t/1only-batches-of-spatial-targets-supported-non-empty-3d-tensors-but-got-targets-of-size-1-3-375-1242/32609 "2018-12-20T01:37:14Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [December 27, 2018, 12:59pm UTC](https://discuss.pytorch.org/t/1only-batches-of-spatial-targets-supported-non-empty-3d-tensors-but-got-targets-of-size-1-3-375-1242/32609/14 "2018-12-27T12:59:50Z")

</div>

I mean something like a key value pair between your color codes in RGB and the corresponding class index.  
E.g. `[128, 64, 128]` would map to class0.  
Have a look at [this post](https://discuss.pytorch.org/t/error-in-python-s-multiprocessing-library/31355/6?u=ptrblck) for another example using grayscale images.  
Could you post the classes for each separate color in your segmentation mask?

---

_[View the full topic](https://discuss.pytorch.org/t/1only-batches-of-spatial-targets-supported-non-empty-3d-tensors-but-got-targets-of-size-1-3-375-1242/32609)._
