Is this what you intended?



 Andy_Markman:

return torch.add(carry_value, carry_value)


transform_value is calculated but never used.
If transform_layer_output is near to 0, then the above line causes your model to rough double its input.