forward {tfNeuralODE}R Documentation

Forward pass of the Neural ODE network

Description

Forward pass of the Neural ODE network

Usage

forward(model, inputs, tsteps, return_states = FALSE)

Arguments

model

A keras neural network that defines the Neural ODE.

inputs

Matrix or vector inputs to the neural network.

tsteps

A vector of each time step upon which the Neural ODE is solved to get to the final solution.

return_states

A boolean which dictates whether the intermediary states between the input and the final solution are returned.

Value

solution of the forward pass of Neural ODE

Examples


reticulate::py_module_available("tensorflow")

# example code

library(tensorflow)
library(keras)

OdeModel(keras$Model) %py_class% {
 initialize <- function() {
   super$initialize()
   self$block_1 <- layer_dense(units = 50, activation = 'tanh')
   self$block_2 <- layer_dense(units = 2, activation = 'linear')
 }

 call <- function(inputs) {
   x<- inputs ^ 3
   x <- self$block_1(x)
   self$block_2(x)
 }
}
tsteps <- seq(0, 2.5, by = 2.5/10)
true_y0 = t(c(2., 0.))
model<- OdeModel()
forward(model, true_y0, tsteps)



[Package tfNeuralODE version 0.1.0 Index]