Hello all, I am trying to train a neural ODE model using
DiffEqFlux.sciml_train. I have reasons to believe that if I use the outer vector product of the current state
u as the neural net input, I might get better performance and I am trying to test that. The model is roughly as follows (simplified a bit to omit what I think are irrelevant details):
cross_system = function (du, u, p, t, net) cross_vec = collect(Iterators.flatten(u * transpose(u))) du[1:end] = net(p)(cross_vec) end
However, I get the following error during autodiff (full trace here):
ERROR: LoadError: DimensionMismatch("matrix A has dimensions (18,18), matrix B has dimensions (1,18)")
Based on the error message I know what the error MEANS, i.e. somewhere in the code it is trying to multiply 18x18 matrix by a 1x18 row vector which is undefined. I can also understand that the 1x18 row vector most likely appears due to the transpose (without which I don’t really know how to get an outer product efficiently). But I don’t know WHERE the error is located. I don’t think I am doing any matrix-row vector multiplication in my code, so I think it’s down to autodiff magic. At all unsure how to resolve this, any help is appreciated.