<s> from deepy . utils import CrossEntropyCost , EPSILON <EOL> import theano . tensor as T <EOL> class LMCost ( CrossEntropyCost ) : <EOL> def get ( self ) : <EOL> y = T . clip ( self . result_tensor , EPSILON , <NUM_LIT:1.0> - EPSILON ) <EOL> y = y . reshape ( ( - <NUM_LIT:1> , y . shape [ - <NUM_LIT:1> ] ) ) <EOL> k = self . index_tensor . reshape ( ( - <NUM_LIT:1> , ) ) <EOL> return - T . mean ( T . log2 ( y [ T . arange ( k . shape [ <NUM_LIT:0> ] ) , k ] ) ) </s>
