Seems like the shapes don’t match. What is the output shape from modelA and what should the input shape be to modelB? One thing you can do to debug is make print statements in the forward part and make sure each shape is what you expect it to be