add_tensor: Tensor

Description Usage Arguments Examples

Description

Create tensors.

Usage

1
add_tensor(brain, values, name, shape = NULL, dtype = NULL)

Arguments

brain

An object of class brainy as rturned by brainy.

name

Name of tensor, used to refer and use the tensor further down the pipe.

shape

Shape of the tensor.

dtype

Data type, one of float32, int32, bool, complex64.

value

The values of the tensor.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
IN <- c(0, 0, 0)
OUT <- c(1, 1, 1)

## Not run: 
library(shiny)

ui <- fluidPage(brainyOutput("brainy"))

server <- function(input, output){

  output$brainy <- renderBrainy({
    brainy() %>%
    layer_add(
      layer_dense(units = 1)
    ) %>%
    model_compile(
      optimizer = "meanSquaredError",
      loss = "sgd"
    ) %>%
    add_tensor(
      values = IN,
      name = "input"
    ) %>%
    add_tensor(
      values = OUT,
      name = "output"
    )
  })
  
}

shinyApp(ui, server)

## End(Not run)

brain-r/brain.widget documentation built on May 28, 2019, 5:42 p.m.