From 7b6ff571263e6fe3601f3ca46e9bca78539f9e1e Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 21 May 2024 13:39:05 +0000 Subject: [PATCH] cli-3722-10663 --- dev/articles/examples/basic-nn-module.html | 32 ++-- dev/articles/indexing.html | 22 +-- dev/articles/loading-data.html | 2 +- dev/articles/tensor-creation.html | 10 +- dev/articles/torchscript.html | 147 ++++++++++--------- dev/articles/using-autograd.html | 40 ++--- dev/news/index.html | 16 +- dev/pkgdown.yml | 2 +- dev/reference/distr_gamma.html | 2 +- dev/reference/distr_multivariate_normal.html | 4 +- dev/reference/distr_normal.html | 3 +- dev/reference/distr_poisson.html | 2 +- dev/reference/jit_compile.html | 2 +- dev/reference/linalg_cholesky_ex.html | 4 +- dev/reference/linalg_det.html | 6 +- dev/reference/linalg_eigh.html | 9 +- dev/reference/linalg_eigvalsh.html | 4 +- dev/reference/linalg_inv.html | 8 +- dev/reference/linalg_pinv.html | 10 +- dev/reference/linalg_slogdet.html | 4 +- dev/reference/linalg_solve.html | 2 +- dev/reference/linalg_svd.html | 22 +-- dev/reference/linalg_svdvals.html | 6 +- dev/reference/nn_avg_pool1d.html | 2 +- dev/reference/nn_embedding.html | 4 +- dev/reference/nn_flatten.html | 60 ++++---- dev/reference/nn_init_kaiming_normal_.html | 6 +- dev/reference/nn_init_kaiming_uniform_.html | 6 +- dev/reference/nn_init_normal_.html | 6 +- dev/reference/nn_init_orthogonal_.html | 6 +- dev/reference/nn_init_trunc_normal_.html | 6 +- dev/reference/nn_init_uniform_.html | 6 +- dev/reference/nn_init_xavier_normal_.html | 6 +- dev/reference/nn_init_xavier_uniform_.html | 6 +- dev/reference/nn_max_unpool2d.html | 6 +- dev/reference/nn_relu.html | 2 +- dev/reference/nn_rnn.html | 78 +++++----- dev/reference/nn_rrelu.html | 5 +- dev/reference/slc.html | 6 +- dev/reference/torch_acos.html | 4 +- dev/reference/torch_acosh.html | 8 +- dev/reference/torch_add.html | 8 +- dev/reference/torch_addbmm.html | 6 +- dev/reference/torch_addcdiv.html | 6 +- dev/reference/torch_addcmul.html | 7 +- dev/reference/torch_addmm.html | 4 +- dev/reference/torch_addmv.html | 4 +- dev/reference/torch_amax.html | 8 +- dev/reference/torch_amin.html | 8 +- dev/reference/torch_argmax.html | 2 +- dev/reference/torch_argmin.html | 8 +- dev/reference/torch_argsort.html | 8 +- dev/reference/torch_as_strided.html | 4 +- dev/reference/torch_asin.html | 4 +- dev/reference/torch_asinh.html | 8 +- dev/reference/torch_atan.html | 8 +- dev/reference/torch_atan2.html | 8 +- dev/reference/torch_atanh.html | 8 +- dev/reference/torch_baddbmm.html | 36 ++--- dev/reference/torch_bincount.html | 9 +- dev/reference/torch_bmm.html | 36 ++--- dev/reference/torch_cat.html | 4 +- dev/reference/torch_ceil.html | 4 +- dev/reference/torch_chain_matmul.html | 6 +- dev/reference/torch_channel_shuffle.html | 32 ++-- dev/reference/torch_cholesky_solve.html | 6 +- dev/reference/torch_clamp.html | 6 +- dev/reference/torch_conv1d.html | 58 ++++---- dev/reference/torch_conv2d.html | 42 +++--- dev/reference/torch_conv_transpose1d.html | 58 ++++---- dev/reference/torch_conv_transpose2d.html | 42 +++--- dev/reference/torch_cos.html | 8 +- dev/reference/torch_cosh.html | 8 +- dev/reference/torch_cosine_similarity.html | 60 ++++---- dev/reference/torch_count_nonzero.html | 4 +- dev/reference/torch_cross.html | 8 +- dev/reference/torch_cummax.html | 36 ++--- dev/reference/torch_cummin.html | 36 ++--- dev/reference/torch_cumprod.html | 21 +-- dev/reference/torch_cumsum.html | 20 +-- dev/reference/torch_det.html | 6 +- dev/reference/torch_diag_embed.html | 12 +- dev/reference/torch_diagflat.html | 8 +- dev/reference/torch_diagonal.html | 16 +- dev/reference/torch_dist.html | 2 +- dev/reference/torch_div.html | 8 +- dev/reference/torch_floor.html | 2 +- dev/reference/torch_index_select.html | 6 +- dev/reference/torch_log.html | 7 +- dev/reference/torch_log10.html | 10 +- dev/reference/torch_log1p.html | 10 +- dev/reference/torch_log2.html | 10 +- dev/reference/torch_logcumsumexp.html | 20 +-- dev/reference/torch_logit.html | 10 +- dev/reference/torch_logsumexp.html | 6 +- dev/reference/torch_lu.html | 14 +- dev/reference/torch_lu_solve.html | 2 +- dev/reference/torch_masked_select.html | 12 +- dev/reference/torch_matmul.html | 36 ++--- dev/reference/torch_matrix_power.html | 9 +- dev/reference/torch_max.html | 8 +- dev/reference/torch_mean.html | 2 +- dev/reference/torch_median.html | 14 +- dev/reference/torch_min.html | 8 +- dev/reference/torch_mm.html | 4 +- dev/reference/torch_mode.html | 2 +- dev/reference/torch_movedim.html | 4 +- dev/reference/torch_mul.html | 8 +- dev/reference/torch_mv.html | 4 +- dev/reference/torch_mvlgamma.html | 4 +- dev/reference/torch_neg.html | 10 +- dev/reference/torch_normal.html | 2 +- dev/reference/torch_pinverse.html | 12 +- dev/reference/torch_poisson.html | 8 +- dev/reference/torch_prod.html | 4 +- dev/reference/torch_rand.html | 4 +- dev/reference/torch_randint.html | 4 +- dev/reference/torch_randn.html | 4 +- dev/reference/torch_randperm.html | 4 +- dev/reference/torch_reciprocal.html | 8 +- dev/reference/torch_round.html | 4 +- dev/reference/torch_rsqrt.html | 6 +- dev/reference/torch_sigmoid.html | 8 +- dev/reference/torch_sin.html | 8 +- dev/reference/torch_sinh.html | 8 +- dev/reference/torch_slogdet.html | 4 +- dev/reference/torch_sort.html | 10 +- dev/reference/torch_sqrt.html | 4 +- dev/reference/torch_square.html | 8 +- dev/reference/torch_std.html | 8 +- dev/reference/torch_std_mean.html | 16 +- dev/reference/torch_svd.html | 2 +- dev/reference/torch_t.html | 6 +- dev/reference/torch_tan.html | 8 +- dev/reference/torch_tanh.html | 8 +- dev/reference/torch_transpose.html | 6 +- dev/reference/torch_trapz.html | 4 +- dev/reference/torch_triangular_solve.html | 8 +- dev/reference/torch_tril.html | 7 +- dev/reference/torch_triu.html | 8 +- dev/reference/torch_trunc.html | 6 +- dev/reference/torch_var.html | 8 +- dev/reference/torch_var_mean.html | 16 +- dev/reference/with_detect_anomaly.html | 40 ++--- dev/search.json | 2 +- 145 files changed, 892 insertions(+), 876 deletions(-) diff --git a/dev/articles/examples/basic-nn-module.html b/dev/articles/examples/basic-nn-module.html index caa64d0c29..2800db6f78 100644 --- a/dev/articles/examples/basic-nn-module.html +++ b/dev/articles/examples/basic-nn-module.html @@ -148,9 +148,9 @@ model$parameters
## $w
 ## torch_tensor
-##  0.3370
-##  0.7713
-##  0.8249
+## -0.3916
+## -1.1445
+## -1.2119
 ## [ CPUFloatType{3,1} ][ requires_grad = TRUE ]
 ## 
 ## $b
@@ -161,9 +161,9 @@ 
 # or individually
 model$w
## torch_tensor
-##  0.3370
-##  0.7713
-##  0.8249
+## -0.3916
+## -1.1445
+## -1.2119
 ## [ CPUFloatType{3,1} ][ requires_grad = TRUE ]
 model$b
@@ -178,16 +178,16 @@
 y_pred
## torch_tensor
-##  2.0278
-## -0.3491
-## -0.5203
-## -1.0480
-## -0.0764
-##  0.9610
-## -0.7402
-##  0.4493
-##  0.8592
-## -1.4762
+## -1.3537
+##  0.7933
+##  4.0181
+##  1.6038
+## -2.7807
+##  0.0302
+##  1.1312
+## -1.6102
+## -1.8427
+##  0.5165
 ## [ CPUFloatType{10,1} ][ grad_fn = <AddBackward0> ]
diff --git a/dev/articles/indexing.html b/dev/articles/indexing.html index 58a223d503..eafca69bc1 100644 --- a/dev/articles/indexing.html +++ b/dev/articles/indexing.html @@ -264,23 +264,23 @@

Getting the complete dimensionx <- torch_randn(2, 3) x #> torch_tensor -#> -2.0805 0.1446 1.6611 -#> -0.6926 -1.1634 1.7452 +#> -1.7267 -1.5332 0.0411 +#> 0.6494 -0.4169 1.0826 #> [ CPUFloatType{2,3} ]

The following syntax will give you the first row:

 x[1,]
 #> torch_tensor
-#> -2.0805
-#>  0.1446
-#>  1.6611
+#> -1.7267
+#> -1.5332
+#>  0.0411
 #> [ CPUFloatType{3} ]

And this would give you the first 2 columns:

 x[,1:2]
 #> torch_tensor
-#> -2.0805  0.1446
-#> -0.6926 -1.1634
+#> -1.7267 -1.5332
+#>  0.6494 -0.4169
 #> [ CPUFloatType{2,2} ]
@@ -362,15 +362,15 @@

Indexing with vectorsx <- torch_randn(4,4) x[c(1,3), c(1,3)] #> torch_tensor -#> 0.9505 0.3747 -#> 0.3706 -1.7638 +#> -0.3441 -1.9536 +#> -0.5751 -1.2965 #> [ CPUFloatType{2,2} ]

You can also use boolean vectors, for example:

 x[c(TRUE, FALSE, TRUE, FALSE), c(TRUE, FALSE, TRUE, FALSE)]
 #> torch_tensor
-#>  0.9505  0.3747
-#>  0.3706 -1.7638
+#> -0.3441 -1.9536
+#> -0.5751 -1.2965
 #> [ CPUFloatType{2,2} ]

The above examples also work if the index were long or boolean tensors, instead of R vectors. It’s also possible to index with diff --git a/dev/articles/loading-data.html b/dev/articles/loading-data.html index 14f7276159..2065052b82 100644 --- a/dev/articles/loading-data.html +++ b/dev/articles/loading-data.html @@ -401,7 +401,7 @@

Training with data loaders cat(sprintf("Loss at epoch %d: %3f\n", epoch, mean(l))) } -#> Loss at epoch 1: 86.870900 +#> Loss at epoch 1: 18373.926576 #> Loss at epoch 2: 2.068251 #> Loss at epoch 3: 2.068251 #> Loss at epoch 4: 2.068251 diff --git a/dev/articles/tensor-creation.html b/dev/articles/tensor-creation.html index fa45ce1f7f..70b250d064 100644 --- a/dev/articles/tensor-creation.html +++ b/dev/articles/tensor-creation.html @@ -200,11 +200,11 @@

Using creation functionsx <- torch_randn(5, 3) x #> torch_tensor -#> 0.0821 -1.7287 -0.9899 -#> 0.8543 0.8610 1.6732 -#> -0.5398 0.4513 -0.8628 -#> 0.5736 -0.4819 0.6148 -#> 1.4036 1.8596 -0.4524 +#> 0.7903 0.7884 1.6036 +#> 1.3162 0.0087 -0.6370 +#> -0.2667 -0.3238 1.6555 +#> 1.3786 1.1351 -0.7340 +#> 0.4240 -0.8986 -1.7643 #> [ CPUFloatType{5,3} ]

Another example is torch_ones, which creates a tensor filled with ones.

diff --git a/dev/articles/torchscript.html b/dev/articles/torchscript.html index 31234e78ae..bfd572b8d5 100644 --- a/dev/articles/torchscript.html +++ b/dev/articles/torchscript.html @@ -172,9 +172,10 @@

Tracing
 traced_fn(torch_randn(3))
 #> torch_tensor
+#> 0.01 *
 #>  0.0000
-#>  1.3290
-#>  0.5517
+#>  0.0000
+#>  4.8860
 #> [ CPUFloatType{3} ]

It’s also possible to trace nn_modules() defined in R, for example:

@@ -200,9 +201,9 @@

Tracing
 traced_module(torch_randn(3, 10))
 #> torch_tensor
-#>  0.4324
-#>  0.0738
-#>  0.2362
+#>  0.0111
+#>  0.1675
+#> -0.0127
 #> [ CPUFloatType{3,1} ][ grad_fn = <AddmmBackward0> ]

Limitations of tracing @@ -240,18 +241,18 @@

Limitations of tracingtraced_dropout <- jit_trace(nn_dropout(), torch_ones(5,5)) traced_dropout(torch_ones(3,3)) #> torch_tensor -#> 2 0 2 #> 0 0 2 -#> 2 2 2 +#> 0 2 2 +#> 0 0 0 #> [ CPUFloatType{3,3} ]

 traced_dropout$eval()
 # even after setting to eval mode, dropout is applied
 traced_dropout(torch_ones(3,3))
 #> torch_tensor
-#>  2  2  0
 #>  0  0  2
-#>  2  0  2
+#>  2  2  0
+#>  0  2  2
 #> [ CPUFloatType{3,3} ]
  1. Tracing proegrams can only take tensors and lists of tensors as @@ -264,70 +265,70 @@

    Limitations of tracingjit_trace(fn, torch_tensor(1), 1) #> Error in cpp_trace_function(tr_fn, list(...), .compilation_unit, strict, : Only tensors or (possibly nested) dict or tuples of tensors can be inputs to traced functions. Got float #> Exception raised from addInput at /Users/runner/work/pytorch/pytorch/pytorch/torch/csrc/jit/frontend/tracer.cpp:422 (most recent call first): -#> frame #0: c10::Error::Error(c10::SourceLocation, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>) + 81 (0x10cd03ca1 in libc10.dylib) -#> frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) + 98 (0x10cd02342 in libc10.dylib) -#> frame #2: torch::jit::tracer::addInput(std::__1::shared_ptr<torch::jit::tracer::TracingState> const&, c10::IValue const&, c10::Type::SingletonOrSharedTypePtr<c10::Type> const&, torch::jit::Value*) + 6052 (0x12ed48564 in libtorch_cpu.dylib) -#> frame #3: torch::jit::tracer::addInput(std::__1::shared_ptr<torch::jit::tracer::TracingState> const&, c10::IValue const&, c10::Type::SingletonOrSharedTypePtr<c10::Type> const&, torch::jit::Value*) + 4445 (0x12ed47f1d in libtorch_cpu.dylib) -#> frame #4: torch::jit::tracer::trace(std::__1::vector<c10::IValue, std::__1::allocator<c10::IValue>>, std::__1::function<std::__1::vector<c10::IValue, std::__1::allocator<c10::IValue>> (std::__1::vector<c10::IValue, std::__1::allocator<c10::IValue>>)> const&, std::__1::function<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> (at::Tensor const&)>, bool, bool, torch::jit::Module*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) + 826 (0x12ed4559a in libtorch_cpu.dylib) -#> frame #5: _lantern_trace_fn + 597 (0x1117d9b35 in liblantern.dylib) -#> frame #6: cpp_trace_function(Rcpp::Function_Impl<Rcpp::PreserveStorage>, XPtrTorchStack, XPtrTorchCompilationUnit, XPtrTorchstring, bool, XPtrTorchScriptModule, bool, bool) + 566 (0x10f97f176 in torchpkg.so) -#> frame #7: _torch_cpp_trace_function + 719 (0x10f7b9acf in torchpkg.so) -#> frame #8: R_doDotCall + 13245 (0x10a00fa3d in libR.dylib) -#> frame #9: bcEval_loop + 146643 (0x10a0776d3 in libR.dylib) -#> frame #10: bcEval + 628 (0x10a045374 in libR.dylib) -#> frame #11: Rf_eval + 506 (0x10a044a7a in libR.dylib) -#> frame #12: R_execClosure + 761 (0x10a0475b9 in libR.dylib) -#> frame #13: applyClosure_core + 128 (0x10a0466c0 in libR.dylib) -#> frame #14: Rf_eval + 1189 (0x10a044d25 in libR.dylib) -#> frame #15: do_eval + 1253 (0x10a04c0e5 in libR.dylib) -#> frame #16: bcEval_loop + 44476 (0x10a05e7bc in libR.dylib) -#> frame #17: bcEval + 628 (0x10a045374 in libR.dylib) -#> frame #18: Rf_eval + 506 (0x10a044a7a in libR.dylib) -#> frame #19: forcePromise + 230 (0x10a0455a6 in libR.dylib) -#> frame #20: Rf_eval + 634 (0x10a044afa in libR.dylib) -#> frame #21: do_withVisible + 57 (0x10a04c479 in libR.dylib) -#> frame #22: do_internal + 362 (0x10a0c40aa in libR.dylib) -#> frame #23: bcEval_loop + 45103 (0x10a05ea2f in libR.dylib) -#> frame #24: bcEval + 628 (0x10a045374 in libR.dylib) -#> frame #25: Rf_eval + 506 (0x10a044a7a in libR.dylib) -#> frame #26: R_execClosure + 761 (0x10a0475b9 in libR.dylib) -#> frame #27: applyClosure_core + 128 (0x10a0466c0 in libR.dylib) -#> frame #28: Rf_eval + 1189 (0x10a044d25 in libR.dylib) -#> frame #29: do_begin + 429 (0x10a049fad in libR.dylib) -#> frame #30: Rf_eval + 990 (0x10a044c5e in libR.dylib) -#> frame #31: R_execClosure + 761 (0x10a0475b9 in libR.dylib) -#> frame #32: applyClosure_core + 128 (0x10a0466c0 in libR.dylib) -#> frame #33: Rf_eval + 1189 (0x10a044d25 in libR.dylib) -#> frame #34: do_docall + 615 (0x109fd5827 in libR.dylib) -#> frame #35: bcEval_loop + 44476 (0x10a05e7bc in libR.dylib) -#> frame #36: bcEval + 628 (0x10a045374 in libR.dylib) -#> frame #37: Rf_eval + 506 (0x10a044a7a in libR.dylib) -#> frame #38: R_execClosure + 761 (0x10a0475b9 in libR.dylib) -#> frame #39: applyClosure_core + 128 (0x10a0466c0 in libR.dylib) -#> frame #40: Rf_eval + 1189 (0x10a044d25 in libR.dylib) -#> frame #41: do_docall + 615 (0x109fd5827 in libR.dylib) -#> frame #42: bcEval_loop + 44476 (0x10a05e7bc in libR.dylib) -#> frame #43: bcEval + 628 (0x10a045374 in libR.dylib) -#> frame #44: Rf_eval + 506 (0x10a044a7a in libR.dylib) -#> frame #45: R_execClosure + 761 (0x10a0475b9 in libR.dylib) -#> frame #46: applyClosure_core + 128 (0x10a0466c0 in libR.dylib) -#> frame #47: Rf_eval + 1189 (0x10a044d25 in libR.dylib) -#> frame #48: forcePromise + 230 (0x10a0455a6 in libR.dylib) -#> frame #49: bcEval_loop + 19496 (0x10a058628 in libR.dylib) -#> frame #50: bcEval + 628 (0x10a045374 in libR.dylib) -#> frame #51: Rf_eval + 506 (0x10a044a7a in libR.dylib) -#> frame #52: R_execClosure + 761 (0x10a0475b9 in libR.dylib) -#> frame #53: applyClosure_core + 128 (0x10a0466c0 in libR.dylib) -#> frame #54: Rf_eval + 1189 (0x10a044d25 in libR.dylib) -#> frame #55: do_begin + 429 (0x10a049fad in libR.dylib) -#> frame #56: Rf_eval + 990 (0x10a044c5e in libR.dylib) -#> frame #57: forcePromise + 230 (0x10a0455a6 in libR.dylib) -#> frame #58: bcEval_loop + 19496 (0x10a058628 in libR.dylib) -#> frame #59: bcEval + 628 (0x10a045374 in libR.dylib) -#> frame #60: Rf_eval + 506 (0x10a044a7a in libR.dylib) -#> frame #61: R_execClosure + 761 (0x10a0475b9 in libR.dylib) -#> frame #62: applyClosure_core + 128 (0x10a0466c0 in libR.dylib) -#> frame #63: Rf_eval + 1189 (0x10a044d25 in libR.dylib) +#> frame #0: c10::Error::Error(c10::SourceLocation, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>) + 81 (0x105097ca1 in libc10.dylib) +#> frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) + 98 (0x105096342 in libc10.dylib) +#> frame #2: torch::jit::tracer::addInput(std::__1::shared_ptr<torch::jit::tracer::TracingState> const&, c10::IValue const&, c10::Type::SingletonOrSharedTypePtr<c10::Type> const&, torch::jit::Value*) + 6052 (0x1270dc564 in libtorch_cpu.dylib) +#> frame #3: torch::jit::tracer::addInput(std::__1::shared_ptr<torch::jit::tracer::TracingState> const&, c10::IValue const&, c10::Type::SingletonOrSharedTypePtr<c10::Type> const&, torch::jit::Value*) + 4445 (0x1270dbf1d in libtorch_cpu.dylib) +#> frame #4: torch::jit::tracer::trace(std::__1::vector<c10::IValue, std::__1::allocator<c10::IValue>>, std::__1::function<std::__1::vector<c10::IValue, std::__1::allocator<c10::IValue>> (std::__1::vector<c10::IValue, std::__1::allocator<c10::IValue>>)> const&, std::__1::function<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> (at::Tensor const&)>, bool, bool, torch::jit::Module*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) + 826 (0x1270d959a in libtorch_cpu.dylib) +#> frame #5: _lantern_trace_fn + 597 (0x109b6db35 in liblantern.dylib) +#> frame #6: cpp_trace_function(Rcpp::Function_Impl<Rcpp::PreserveStorage>, XPtrTorchStack, XPtrTorchCompilationUnit, XPtrTorchstring, bool, XPtrTorchScriptModule, bool, bool) + 566 (0x107d13176 in torchpkg.so) +#> frame #7: _torch_cpp_trace_function + 719 (0x107b4dacf in torchpkg.so) +#> frame #8: R_doDotCall + 13245 (0x1023a3a3d in libR.dylib) +#> frame #9: bcEval_loop + 146643 (0x10240b6d3 in libR.dylib) +#> frame #10: bcEval + 628 (0x1023d9374 in libR.dylib) +#> frame #11: Rf_eval + 506 (0x1023d8a7a in libR.dylib) +#> frame #12: R_execClosure + 761 (0x1023db5b9 in libR.dylib) +#> frame #13: applyClosure_core + 128 (0x1023da6c0 in libR.dylib) +#> frame #14: Rf_eval + 1189 (0x1023d8d25 in libR.dylib) +#> frame #15: do_eval + 1253 (0x1023e00e5 in libR.dylib) +#> frame #16: bcEval_loop + 44476 (0x1023f27bc in libR.dylib) +#> frame #17: bcEval + 628 (0x1023d9374 in libR.dylib) +#> frame #18: Rf_eval + 506 (0x1023d8a7a in libR.dylib) +#> frame #19: forcePromise + 230 (0x1023d95a6 in libR.dylib) +#> frame #20: Rf_eval + 634 (0x1023d8afa in libR.dylib) +#> frame #21: do_withVisible + 57 (0x1023e0479 in libR.dylib) +#> frame #22: do_internal + 362 (0x1024580aa in libR.dylib) +#> frame #23: bcEval_loop + 45103 (0x1023f2a2f in libR.dylib) +#> frame #24: bcEval + 628 (0x1023d9374 in libR.dylib) +#> frame #25: Rf_eval + 506 (0x1023d8a7a in libR.dylib) +#> frame #26: R_execClosure + 761 (0x1023db5b9 in libR.dylib) +#> frame #27: applyClosure_core + 128 (0x1023da6c0 in libR.dylib) +#> frame #28: Rf_eval + 1189 (0x1023d8d25 in libR.dylib) +#> frame #29: do_begin + 429 (0x1023ddfad in libR.dylib) +#> frame #30: Rf_eval + 990 (0x1023d8c5e in libR.dylib) +#> frame #31: R_execClosure + 761 (0x1023db5b9 in libR.dylib) +#> frame #32: applyClosure_core + 128 (0x1023da6c0 in libR.dylib) +#> frame #33: Rf_eval + 1189 (0x1023d8d25 in libR.dylib) +#> frame #34: do_docall + 615 (0x102369827 in libR.dylib) +#> frame #35: bcEval_loop + 44476 (0x1023f27bc in libR.dylib) +#> frame #36: bcEval + 628 (0x1023d9374 in libR.dylib) +#> frame #37: Rf_eval + 506 (0x1023d8a7a in libR.dylib) +#> frame #38: R_execClosure + 761 (0x1023db5b9 in libR.dylib) +#> frame #39: applyClosure_core + 128 (0x1023da6c0 in libR.dylib) +#> frame #40: Rf_eval + 1189 (0x1023d8d25 in libR.dylib) +#> frame #41: do_docall + 615 (0x102369827 in libR.dylib) +#> frame #42: bcEval_loop + 44476 (0x1023f27bc in libR.dylib) +#> frame #43: bcEval + 628 (0x1023d9374 in libR.dylib) +#> frame #44: Rf_eval + 506 (0x1023d8a7a in libR.dylib) +#> frame #45: R_execClosure + 761 (0x1023db5b9 in libR.dylib) +#> frame #46: applyClosure_core + 128 (0x1023da6c0 in libR.dylib) +#> frame #47: Rf_eval + 1189 (0x1023d8d25 in libR.dylib) +#> frame #48: forcePromise + 230 (0x1023d95a6 in libR.dylib) +#> frame #49: bcEval_loop + 19496 (0x1023ec628 in libR.dylib) +#> frame #50: bcEval + 628 (0x1023d9374 in libR.dylib) +#> frame #51: Rf_eval + 506 (0x1023d8a7a in libR.dylib) +#> frame #52: R_execClosure + 761 (0x1023db5b9 in libR.dylib) +#> frame #53: applyClosure_core + 128 (0x1023da6c0 in libR.dylib) +#> frame #54: Rf_eval + 1189 (0x1023d8d25 in libR.dylib) +#> frame #55: do_begin + 429 (0x1023ddfad in libR.dylib) +#> frame #56: Rf_eval + 990 (0x1023d8c5e in libR.dylib) +#> frame #57: forcePromise + 230 (0x1023d95a6 in libR.dylib) +#> frame #58: bcEval_loop + 19496 (0x1023ec628 in libR.dylib) +#> frame #59: bcEval + 628 (0x1023d9374 in libR.dylib) +#> frame #60: Rf_eval + 506 (0x1023d8a7a in libR.dylib) +#> frame #61: R_execClosure + 761 (0x1023db5b9 in libR.dylib) +#> frame #62: applyClosure_core + 128 (0x1023da6c0 in libR.dylib) +#> frame #63: Rf_eval + 1189 (0x1023d8d25 in libR.dylib) #> : diff --git a/dev/articles/using-autograd.html b/dev/articles/using-autograd.html index 290d9b32c7..5a4172870a 100644 --- a/dev/articles/using-autograd.html +++ b/dev/articles/using-autograd.html @@ -307,26 +307,26 @@

    The simple network, now using aut }) } -#> 10 59.84255 -#> 20 54.88631 -#> 30 50.46177 -#> 40 46.50911 -#> 50 42.97451 -#> 60 39.8021 -#> 70 36.95594 -#> 80 34.4023 -#> 90 32.11378 -#> 100 30.03801 -#> 110 28.15556 -#> 120 26.44344 -#> 130 24.88258 -#> 140 23.45798 -#> 150 22.15623 -#> 160 20.96505 -#> 170 19.871 -#> 180 18.8658 -#> 190 17.94129 -#> 200 17.09041 +#> 10 24.8628 +#> 20 23.42428 +#> 30 22.11072 +#> 40 20.90852 +#> 50 19.80499 +#> 60 18.79099 +#> 70 17.85603 +#> 80 16.99496 +#> 90 16.19974 +#> 100 15.46406 +#> 110 14.78265 +#> 120 14.15048 +#> 130 13.56312 +#> 140 13.01672 +#> 150 12.50762 +#> 160 12.03279 +#> 170 11.5892 +#> 180 11.1732 +#> 190 10.78394 +#> 200 10.41937

    We still manually compute the forward pass, and we still manually update the weights. In the last two chapters of this section, we’ll see how these parts of the logic can be made more modular and reusable, as diff --git a/dev/news/index.html b/dev/news/index.html index 2fd43d5855..38e36f727a 100644 --- a/dev/news/index.html +++ b/dev/news/index.html @@ -85,6 +85,18 @@

    torch (development version)

    +
    +

    Breaking changes

    +
    • lantern is now distributed over a different URL (https://torch-cdn.mlverse.org). For most users this shouldn’t have any effect, unless you need special authorization to access some URL’s. (#1162)
    • +
    +
    +

    New features

    +
    • Added support for a private $finalize_deep_clone() method for nn_module which allows to run some code after cloning a module.
    • +
    • A compare_proxy method for the torch_tensor type was added it allows to compare torch tensors using testthat::expect_equal().
    • +
    • Converting torch tensor to R array works when tensor has ‘cuda’ device (#1130)
    • +
    +
    +

    Bug fixes

    • Fix a bug on using input projection initialization bias in nnf_multi_head_attention_forward (#1154 @cregouby)
    • Bugfix: calling $detach() on a tensor now preserves attributes (#1136)
    • Make sure deep cloning of tensor and nn_module preserves class attributes and the requires_grad field. (#1129)
    • @@ -93,13 +105,11 @@

      #1129) -
    • A compare_proxy method for the torch_tensor type was added it allows to compare torch tensors using testthat::expect_equal().
    • -
    • Converting torch tensor to R array works when tensor has ‘cuda’ device (#1130)
    • Added separate setter and unsetter for the autocast context instead of only allowing local_autocast(). (#1142)
    • Fixed a bug in torch_arange() causing it to return 1:(n-1) values when specific request dtype = torch_int64() (#1160)
    +

    torch 0.12.0

    CRAN release: 2023-12-15

    diff --git a/dev/pkgdown.yml b/dev/pkgdown.yml index dce4ac7a93..034024d377 100644 --- a/dev/pkgdown.yml +++ b/dev/pkgdown.yml @@ -20,7 +20,7 @@ articles: tensor-creation: tensor-creation.html torchscript: torchscript.html using-autograd: using-autograd.html -last_built: 2024-05-18T20:45Z +last_built: 2024-05-21T13:32Z urls: reference: https://torch.mlverse.org/docs/reference article: https://torch.mlverse.org/docs/articles diff --git a/dev/reference/distr_gamma.html b/dev/reference/distr_gamma.html index 003e5a4871..c5a900c3f4 100644 --- a/dev/reference/distr_gamma.html +++ b/dev/reference/distr_gamma.html @@ -127,7 +127,7 @@

    Examplesm$sample() # Gamma distributed with concentration=1 and rate=1 } #> torch_tensor -#> 1.9278 +#> 1.5366 #> [ CPUFloatType{1} ]

    diff --git a/dev/reference/distr_multivariate_normal.html b/dev/reference/distr_multivariate_normal.html index e6f8435105..573312a379 100644 --- a/dev/reference/distr_multivariate_normal.html +++ b/dev/reference/distr_multivariate_normal.html @@ -161,8 +161,8 @@

    Examplesm$sample() # normally distributed with mean=`[0,0]` and covariance_matrix=`I` } #> torch_tensor -#> -0.7238 -#> 1.4476 +#> 1.7619 +#> 0.7454 #> [ CPUFloatType{2} ] diff --git a/dev/reference/distr_normal.html b/dev/reference/distr_normal.html index 158a675512..f6981d6223 100644 --- a/dev/reference/distr_normal.html +++ b/dev/reference/distr_normal.html @@ -134,8 +134,7 @@

    Examplesm$sample() # normally distributed with loc=0 and scale=1 } #> torch_tensor -#> 0.001 * -#> 8.3298 +#> -0.6067 #> [ CPUFloatType{1} ] diff --git a/dev/reference/distr_poisson.html b/dev/reference/distr_poisson.html index b6a2f05dd2..ee9ef94c24 100644 --- a/dev/reference/distr_poisson.html +++ b/dev/reference/distr_poisson.html @@ -130,7 +130,7 @@

    Examplesm$sample() } #> torch_tensor -#> 5 +#> 1 #> [ CPUFloatType{1} ] diff --git a/dev/reference/jit_compile.html b/dev/reference/jit_compile.html index cd92306c64..4945760612 100644 --- a/dev/reference/jit_compile.html +++ b/dev/reference/jit_compile.html @@ -119,7 +119,7 @@

    Examplescomp$foo(torch_randn(10)) } #> torch_tensor -#> -0.943646 +#> 6.02789 #> [ CPUFloatType{} ] diff --git a/dev/reference/linalg_cholesky_ex.html b/dev/reference/linalg_cholesky_ex.html index 7cf31875f9..4be4c3e48b 100644 --- a/dev/reference/linalg_cholesky_ex.html +++ b/dev/reference/linalg_cholesky_ex.html @@ -194,8 +194,8 @@

    Examples} #> $L #> torch_tensor -#> -0.6167 0.0000 -#> 1.1488 -0.9119 +#> -0.6342 0.0000 +#> 1.6000 -1.5099 #> [ CPUFloatType{2,2} ] #> #> $info diff --git a/dev/reference/linalg_det.html b/dev/reference/linalg_det.html index 96c33d9429..c7dc77064c 100644 --- a/dev/reference/linalg_det.html +++ b/dev/reference/linalg_det.html @@ -145,9 +145,9 @@

    Exampleslinalg_det(a) } #> torch_tensor -#> 2.6991 -#> 0.1317 -#> -4.1311 +#> 0.4811 +#> -2.0503 +#> 0.0384 #> [ CPUFloatType{3} ] diff --git a/dev/reference/linalg_eigh.html b/dev/reference/linalg_eigh.html index b5ced1cfd5..95fab3c876 100644 --- a/dev/reference/linalg_eigh.html +++ b/dev/reference/linalg_eigh.html @@ -212,14 +212,15 @@

    Examples} #> [[1]] #> torch_tensor -#> -1.0190 -#> 3.0070 +#> -1.5540 +#> 2.7812 #> [ CPUFloatType{2} ] #> #> [[2]] #> torch_tensor -#> -0.9814 0.1922 -#> 0.1922 0.9814 +#> 0.001 * +#> 5.4828 -999.9850 +#> -999.9850 -5.4828 #> [ CPUFloatType{2,2} ] #> diff --git a/dev/reference/linalg_eigvalsh.html b/dev/reference/linalg_eigvalsh.html index 4aeb6ceeba..1b628c344f 100644 --- a/dev/reference/linalg_eigvalsh.html +++ b/dev/reference/linalg_eigvalsh.html @@ -171,8 +171,8 @@

    Exampleslinalg_eigvalsh(a) } #> torch_tensor -#> -3.2633 -#> 1.2766 +#> -1.3851 +#> 0.2263 #> [ CPUFloatType{2} ] diff --git a/dev/reference/linalg_inv.html b/dev/reference/linalg_inv.html index 3d3e8cf87e..1888deade7 100644 --- a/dev/reference/linalg_inv.html +++ b/dev/reference/linalg_inv.html @@ -160,10 +160,10 @@

    Exampleslinalg_inv(A) } #> torch_tensor -#> -0.0108 0.2711 1.0360 -0.4482 -#> 0.3357 -0.2170 -0.7318 -0.1640 -#> 0.1736 0.3886 -1.0204 0.0724 -#> -0.3547 0.0079 -1.0735 0.2402 +#> 0.1189 0.0565 0.3704 0.1610 +#> 0.1041 -0.3640 0.0131 0.2660 +#> -1.0668 0.0725 0.1970 0.4668 +#> -0.0387 -0.2486 0.4554 -0.5094 #> [ CPUFloatType{4,4} ] diff --git a/dev/reference/linalg_pinv.html b/dev/reference/linalg_pinv.html index 87bcab43e6..68edc5ec0d 100644 --- a/dev/reference/linalg_pinv.html +++ b/dev/reference/linalg_pinv.html @@ -193,11 +193,11 @@

    Exampleslinalg_pinv(A) } #> torch_tensor -#> -0.4445 -0.1212 0.4383 -#> 0.0858 0.2503 -0.2687 -#> 0.0302 0.2172 -0.3934 -#> -0.6678 -0.1615 1.5284 -#> 0.3026 0.3315 -1.3538 +#> -0.4118 -1.0465 0.4831 +#> 0.4265 -0.2673 0.1625 +#> -0.1734 -0.4424 0.3841 +#> -0.6066 -1.1896 0.1427 +#> -0.6381 -0.5579 -0.5971 #> [ CPUFloatType{5,3} ] diff --git a/dev/reference/linalg_slogdet.html b/dev/reference/linalg_slogdet.html index cc5c3fa0df..33969263dc 100644 --- a/dev/reference/linalg_slogdet.html +++ b/dev/reference/linalg_slogdet.html @@ -164,12 +164,12 @@

    Examples} #> [[1]] #> torch_tensor -#> -1 +#> 1 #> [ CPUFloatType{} ] #> #> [[2]] #> torch_tensor -#> 0.774393 +#> 0.625463 #> [ CPUFloatType{} ] #> diff --git a/dev/reference/linalg_solve.html b/dev/reference/linalg_solve.html index e46d2f2a1b..01d2fc9d9b 100644 --- a/dev/reference/linalg_solve.html +++ b/dev/reference/linalg_solve.html @@ -170,7 +170,7 @@

    Examplesx <- linalg_solve(A, b) torch_allclose(torch_matmul(A, x), b) } -#> [1] FALSE +#> [1] TRUE