library("tensorflow")

runTFDemo <- function() {
    loc <- tf$Variable(rep(0, 2))
    dataPoint <- tf$placeholder(tf$float32, c(2))
    scaleDiag <- tf$constant(c(1, 1))
    distn <- tf$contrib$distributions$MultivariateNormalDiag(loc, scaleDiag)
    dens <- distn$prob(dataPoint)
    sess <- tf$Session()
    sess$run(tf$global_variables_initializer())
    set.seed(1)
    x <- rnorm(2)
    out <- sess$run(dens, feed_dict = dict(dataPoint = x))
    cat(paste0("Density value for x is ", out, ".\n"))
}
