implementation of weighted cost
Created by: jmliu88
Say I have a prediction sequence $\hat{Y} = [\hat{y_1}, ... , \hat{y_T}]$ which comes from paddle.v2.layer.lstmemory, a target sequence $Y = [y_1, ..., y_T]$ comes from
paddle.layer.data( name='target', type=paddle.data_type.integer_value_sequence(label_dict_len))
, and a weight sequence $W=[w_1, ..., w_T]$. Is there a way to calculate cost as $\sum_t w_t*cross_entropy(\hat{y_t}, y_t)$ ?
Thanks