I don’t know where this mapping is used, but based on the error message your target still contains 4 dimensions (now the channel dimension seems to be in dim1).
Could you show how you’ve tried to map the color values to the class indices in the target tensor?