Hi,
This ia expected. Each operations that you do add an operation in the computational graph. You’re creating a huge graph here so the backward pass is going to be very slow. You will need to parallelize your operations using builtin functions and/or masking.