knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(rTorch)
(a <- torch$tensor(seq(1, 10))) (b <- torch$ones(10L)) (c <- torch$linspace(0.1, 1.0, steps = 10L))
a$add(b) == a + b
a + c == c$add(a)
a + b + c
a - c == a$sub(c)
a - b - c
a * b == a$mul(b)
a * b * c
# division by integers not accepted a$dtype c$dtype torch$div(a, c) == a / c
b$dtype a / c / b
2^a
a^(1 / c)
c$log10()
c$log()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.