apply_tanh_slice for rnn nonlinearity