inst/doc/saved_models.R

## ----setup, include=FALSE------------------------------------------------
knitr::opts_chunk$set(eval = FALSE)

## ------------------------------------------------------------------------
#  library(keras)
#  library(tfdeploy)
#  
#  test_images <- dataset_mnist()$test$x
#  test_images <- array_reshape(test_images, dim = c(nrow(test_images), 784)) / 255
#  test_images <- lapply(1:10, function(i) {test_images[i,]})
#  
#  predict_savedmodel(processed_test_list, 'savedmodel')

## ------------------------------------------------------------------------
#  # if there will only be one batch of predictions
#  predict_savedmodel(instances, 'savedmodel')
#  
#  # if there will be multiple batches of predictions
#  sess <- tensorflow::tf$Session()
#  graph <- load_savedmodel(sess, 'savedmodel')
#  predict_savedmodel(instances, graph)
#  # ... more work ...
#  predict_savedmodel(instances, graph)

Try the tfdeploy package in your browser

Any scripts or data that you put into this service are public.

tfdeploy documentation built on June 14, 2019, 5:04 p.m.