Skip to contents

Each op is a list(kind=..., param=...) for "linear"/"bias", list(kind=...) for "relu"/"tanh"/"sigmoid", or a plain R function. Records observed input/output shapes.

Usage

morie_geron_trace(model, example_inputs)

Arguments

model

List of ops.

example_inputs

Matrix/vector input.

Value

list(graph, output) where graph is a list of node lists (index, kind, in_shape, out_shape, op).

Examples

set.seed(4)
model <- list(list(kind = "linear", param = matrix(rnorm(6, 0, 0.5), 2, 3)),
              list(kind = "relu"),
              list(kind = "linear", param = matrix(rnorm(3, 0, 0.5), 3, 1)))
r <- morie_geron_trace(model, matrix(rnorm(8), 4, 2))
str(r, max.level = 1)
#> List of 2
#>  $ graph :List of 3
#>  $ output: num [1:4, 1] 1.1491 0.3893 0.0613 0.6226