I am trying to use an R-script in a docker environment to do some classification on the input that I am piping to it.
The script should only print the output of the classification, however I always get Using TensorFlow backend.
as output of the first line where a function of Keras is called.
I made a small working example.
library(keras)
v <- (c(1,2,3))
print(v)
vCat<-to_categorical(v)
I want to display this as output:
[1] 1 2 3
I get however
[1] 1 2 3
Using TensorFlow backend.
So I searched around on google and stackoverflow about sink
and suppress...
and other stuff, from for example Suppress automatic output to console in R, Suppress one command's output in R and Suppress automatic output to console in R. I then tried the following piece of code:
library(keras, quietly = T)
v <- (c(1,2,3))
print(v)
sink("/dev/null")
capture.output(suppressMessages(suppressWarnings(
suppressPackageStartupMessages(
vCat<-to_categorical(v) ))), file = "/dev/null")
sink()
This still doesn't suppress the Using TensorFlow backend.
message. The script is called in a docker environment using littler, from the command line: r test.R
.
Note: when just running the script in Rstudio I don't get the message.