How to use multiple inputs in `NeuralODE` object?

Hi, I am trying to use multiple inputs in NeuralODE object and wonder what is the best way to do this. Specifically, I have the following object:

n_ode = NeuralODE(dudt, tspan, Tsit5(), saveat=t, reltol=1e-7, abstol=1e-9)

where dudt is a neural network taking multiple inputs. According to https://github.com/SciML/DiffEqFlux.jl/blob/master/src/neural_de.jl#L64, it looks like I can only pass a single variable x to NeuralODE object, and second argument should be parameter p. So I wonder if it is possible to use multiple inputs in this case?

Thanks!

If your system is just a neural network, then columns define independent systems, so a matrix initial condition would be multiple inputs. The tutorial on MNIST showcases this.

oh sorry I did not make it clear. By saying multiple inputs, I meant “each data point has multiple inputs”, an example is this neural network structure: https://machinelearningmastery.com/wp-content/uploads/2017/08/multiple_inputs.png, where we have two branches of inputs and one output. NeuralODE does not seem to be able to accept more than one branch of inputs, so I am wondering whether there is a way to do so.

UPDATE: I figure out how to pass multiple inputs as a tuple, but it looks like trainable parameters are not correctly captured, as discussed here: How to make parameters of function within Flux.Chain trainable?, if you can take a look at this question, that would be great, thanks!

1 Like