How can I assign different weights to differents positions in a seq to seq task

I am doing machine translation task using sequence to sequence framework (with an encoder and a decoder). As the first few words generated by the decoder is more important than the others, I would like to assign larger weights to them.

I’ve read the doc. However, it seems that I could only assign different weights to different classes rather than positions. I am wondering if anyone knows how to do so?


You can implement those in your custom loss module :slight_smile: