diff --git a/dev/articles/callbacks.html b/dev/articles/callbacks.html index 05d95a64..661dfac3 100644 --- a/dev/articles/callbacks.html +++ b/dev/articles/callbacks.html @@ -240,7 +240,7 @@
torch
Primerinput = torch_randn(2, 3)
input
#> torch_tensor
-#> -0.1615 -0.3987 -1.5443
-#> 0.6225 0.8516 -0.1881
+#> 0.2536 0.7442 -1.3748
+#> 1.1752 0.4839 0.1875
#> [ CPUFloatType{2,3} ]
A nn_module
is constructed from a
nn_module_generator
. nn_linear
is one of the
@@ -132,8 +132,8 @@
torch
Primeroutput = module_1(input)
output
#> torch_tensor
-#> 0.2601 -0.9715 0.3109 -0.1023
-#> -0.1050 -0.2976 -0.0288 0.4191
+#> 0.7590 0.9118 -0.4479 -0.6905
+#> 0.7574 0.3326 -0.7514 -0.2532
#> [ CPUFloatType{2,4} ][ grad_fn = <AddmmBackward0> ]
A neural network with one (4-unit) hidden layer and two outputs needs the following ingredients
@@ -149,8 +149,8 @@torch
Primeroutput = softmax(output)
output
#> torch_tensor
-#> 0.2899 0.4311 0.2790
-#> 0.2569 0.4788 0.2643
+#> 0.2141 0.3827 0.4032
+#> 0.2039 0.3793 0.4168
#> [ CPUFloatType{2,3} ][ grad_fn = <SoftmaxBackward0> ]
We will now continue with showing how such a neural network can be
represented in mlr3torch
.
Note we only use the $train()
, since torch modules do
not have anything that maps to the state
(it is filled by
@@ -211,8 +211,8 @@
While this object allows to easily perform a forward pass, it does
not inherit from nn_module
, which is useful for various
@@ -260,8 +260,8 @@
graph_module(input)
#> torch_tensor
-#> 0.2899 0.4311 0.2790
-#> 0.2569 0.4788 0.2643
+#> 0.2141 0.3827 0.4032
+#> 0.2039 0.3793 0.4168
#> [ CPUFloatType{2,3} ][ grad_fn = <SoftmaxBackward0> ]
ModelDescriptor
to
small_module(batch$x[[1]])
#> torch_tensor
-#> -3.1491 0.3084 0.2427 -1.2166
-#> -2.9427 0.2295 0.2374 -1.1338
-#> -2.9390 0.2340 0.1861 -1.1485
+#> 1.3399 -0.8466 2.5598 1.7150
+#> 1.4827 -0.8560 2.5392 1.6399
+#> 1.2756 -0.8234 2.3903 1.5592
#> [ CPUFloatType{3,4} ][ grad_fn = <AddmmBackward0> ]The first linear layer that takes “Sepal” input
("linear1"
) creates a 2x4 tensor (batch size 2, 4 units),
@@ -703,14 +702,14 @@
We observe that the po("nn_merge_cat")
concatenates
these, as expected:
The printed output of the data descriptor informs us about:
What happens during materialize(lt[1])
is the
following:
We see that the $graph
has a new pipeop with id
"poly.x"
and the output pointer
points to
poly.x
. Also we see that the shape of the tensor is now
diff --git a/dev/pkgdown.yml b/dev/pkgdown.yml
index 78db5c1f..d0913969 100644
--- a/dev/pkgdown.yml
+++ b/dev/pkgdown.yml
@@ -15,7 +15,7 @@ articles:
articles/tabular_learner_list: tabular_learner_list.html
articles/task_list: task_list.html
articles/vision_learner_list: vision_learner_list.html
-last_built: 2025-02-07T11:58Z
+last_built: 2025-02-08T11:18Z
urls:
reference: https://mlr3torch.mlr-org.com/reference
article: https://mlr3torch.mlr-org.com/articles
diff --git a/dev/reference/DataDescriptor.html b/dev/reference/DataDescriptor.html
index dd1037da..d84ec2a9 100644
--- a/dev/reference/DataDescriptor.html
+++ b/dev/reference/DataDescriptor.html
@@ -276,14 +276,14 @@
lt1 = as_lazy_tensor(torch_randn(10, 3))
materialize(lt1, rbind = TRUE)
#> torch_tensor
-#> 0.1314 -0.0394 -0.4198
-#> 0.8667 0.1679 1.3498
-#> 0.9179 -0.4352 -0.1301
-#> 1.4919 -0.0343 1.1603
-#> 0.2211 0.3610 0.6862
-#> 0.4155 0.4313 1.5842
-#> 1.0053 0.4215 0.1882
-#> 0.9157 1.2931 0.3422
-#> 0.8232 -0.2885 -2.3493
-#> -0.5924 1.4279 -0.3074
+#> -0.2307 0.1823 0.2097
+#> -0.6428 0.6536 0.2870
+#> 1.4479 -0.7920 -0.3777
+#> 0.3415 1.1145 1.5837
+#> -0.9979 -0.6988 -1.0908
+#> -1.3704 -0.6609 -0.7390
+#> -0.4050 -1.3284 1.8195
+#> 0.9393 1.5959 0.1830
+#> 1.0662 -0.7867 0.3763
+#> -0.4405 0.4766 0.5412
#> [ CPUFloatType{10,3} ]
materialize(lt1, rbind = FALSE)
#> [[1]]
#> torch_tensor
-#> 0.1314
-#> -0.0394
-#> -0.4198
+#> -0.2307
+#> 0.1823
+#> 0.2097
#> [ CPUFloatType{3} ]
#>
#> [[2]]
#> torch_tensor
-#> 0.8667
-#> 0.1679
-#> 1.3498
+#> -0.6428
+#> 0.6536
+#> 0.2870
#> [ CPUFloatType{3} ]
#>
#> [[3]]
#> torch_tensor
-#> 0.9179
-#> -0.4352
-#> -0.1301
+#> 1.4479
+#> -0.7920
+#> -0.3777
#> [ CPUFloatType{3} ]
#>
#> [[4]]
#> torch_tensor
-#> 1.4919
-#> -0.0343
-#> 1.1603
+#> 0.3415
+#> 1.1145
+#> 1.5837
#> [ CPUFloatType{3} ]
#>
#> [[5]]
#> torch_tensor
-#> 0.2211
-#> 0.3610
-#> 0.6862
+#> -0.9979
+#> -0.6988
+#> -1.0908
#> [ CPUFloatType{3} ]
#>
#> [[6]]
#> torch_tensor
-#> 0.4155
-#> 0.4313
-#> 1.5842
+#> -1.3704
+#> -0.6609
+#> -0.7390
#> [ CPUFloatType{3} ]
#>
#> [[7]]
#> torch_tensor
-#> 1.0053
-#> 0.4215
-#> 0.1882
+#> -0.4050
+#> -1.3284
+#> 1.8195
#> [ CPUFloatType{3} ]
#>
#> [[8]]
#> torch_tensor
-#> 0.9157
-#> 1.2931
-#> 0.3422
+#> 0.9393
+#> 1.5959
+#> 0.1830
#> [ CPUFloatType{3} ]
#>
#> [[9]]
#> torch_tensor
-#> 0.8232
-#> -0.2885
-#> -2.3493
+#> 1.0662
+#> -0.7867
+#> 0.3763
#> [ CPUFloatType{3} ]
#>
#> [[10]]
#> torch_tensor
-#> -0.5924
-#> 1.4279
-#> -0.3074
+#> -0.4405
+#> 0.4766
+#> 0.5412
#> [ CPUFloatType{3} ]
#>
lt2 = as_lazy_tensor(torch_randn(10, 4))
@@ -232,185 +232,184 @@ Examplesmaterialize(d, rbind = TRUE)
#> $lt1
#> torch_tensor
-#> 0.1314 -0.0394 -0.4198
-#> 0.8667 0.1679 1.3498
-#> 0.9179 -0.4352 -0.1301
-#> 1.4919 -0.0343 1.1603
-#> 0.2211 0.3610 0.6862
-#> 0.4155 0.4313 1.5842
-#> 1.0053 0.4215 0.1882
-#> 0.9157 1.2931 0.3422
-#> 0.8232 -0.2885 -2.3493
-#> -0.5924 1.4279 -0.3074
+#> -0.2307 0.1823 0.2097
+#> -0.6428 0.6536 0.2870
+#> 1.4479 -0.7920 -0.3777
+#> 0.3415 1.1145 1.5837
+#> -0.9979 -0.6988 -1.0908
+#> -1.3704 -0.6609 -0.7390
+#> -0.4050 -1.3284 1.8195
+#> 0.9393 1.5959 0.1830
+#> 1.0662 -0.7867 0.3763
+#> -0.4405 0.4766 0.5412
#> [ CPUFloatType{10,3} ]
#>
#> $lt2
#> torch_tensor
-#> 2.3873 0.8665 -1.5042 -0.9010
-#> 0.2335 0.4423 0.3253 1.1769
-#> -0.0780 0.0289 -0.1055 -1.0392
-#> 1.2430 1.1421 0.3086 -1.8605
-#> 0.3941 -1.5138 0.8910 0.5415
-#> -2.3946 -0.5953 0.3587 0.7571
-#> -0.5688 -0.5727 2.1377 1.0852
-#> 0.2346 -2.8475 0.4795 -0.0282
-#> 1.2866 0.4012 -1.1580 0.4107
-#> 1.6895 2.4545 0.5864 0.0007
+#> 0.4685 -0.6564 0.0766 -1.2989
+#> 0.6419 -0.0460 0.7914 -0.7039
+#> -0.6416 -0.1101 1.8043 -0.1597
+#> 0.1335 -1.1284 -0.7767 1.8633
+#> -0.3096 0.4865 -0.9504 -0.4357
+#> 1.1612 1.5158 0.9482 0.3363
+#> 0.9708 0.1084 -0.8600 -0.1317
+#> 1.5243 1.3771 0.3371 0.6340
+#> -1.4071 -0.3108 0.3162 1.9051
+#> -1.5462 0.1936 0.0976 -1.5574
#> [ CPUFloatType{10,4} ]
#>
materialize(d, rbind = FALSE)
#> $lt1
#> $lt1[[1]]
#> torch_tensor
-#> 0.1314
-#> -0.0394
-#> -0.4198
+#> -0.2307
+#> 0.1823
+#> 0.2097
#> [ CPUFloatType{3} ]
#>
#> $lt1[[2]]
#> torch_tensor
-#> 0.8667
-#> 0.1679
-#> 1.3498
+#> -0.6428
+#> 0.6536
+#> 0.2870
#> [ CPUFloatType{3} ]
#>
#> $lt1[[3]]
#> torch_tensor
-#> 0.9179
-#> -0.4352
-#> -0.1301
+#> 1.4479
+#> -0.7920
+#> -0.3777
#> [ CPUFloatType{3} ]
#>
#> $lt1[[4]]
#> torch_tensor
-#> 1.4919
-#> -0.0343
-#> 1.1603
+#> 0.3415
+#> 1.1145
+#> 1.5837
#> [ CPUFloatType{3} ]
#>
#> $lt1[[5]]
#> torch_tensor
-#> 0.2211
-#> 0.3610
-#> 0.6862
+#> -0.9979
+#> -0.6988
+#> -1.0908
#> [ CPUFloatType{3} ]
#>
#> $lt1[[6]]
#> torch_tensor
-#> 0.4155
-#> 0.4313
-#> 1.5842
+#> -1.3704
+#> -0.6609
+#> -0.7390
#> [ CPUFloatType{3} ]
#>
#> $lt1[[7]]
#> torch_tensor
-#> 1.0053
-#> 0.4215
-#> 0.1882
+#> -0.4050
+#> -1.3284
+#> 1.8195
#> [ CPUFloatType{3} ]
#>
#> $lt1[[8]]
#> torch_tensor
-#> 0.9157
-#> 1.2931
-#> 0.3422
+#> 0.9393
+#> 1.5959
+#> 0.1830
#> [ CPUFloatType{3} ]
#>
#> $lt1[[9]]
#> torch_tensor
-#> 0.8232
-#> -0.2885
-#> -2.3493
+#> 1.0662
+#> -0.7867
+#> 0.3763
#> [ CPUFloatType{3} ]
#>
#> $lt1[[10]]
#> torch_tensor
-#> -0.5924
-#> 1.4279
-#> -0.3074
+#> -0.4405
+#> 0.4766
+#> 0.5412
#> [ CPUFloatType{3} ]
#>
#>
#> $lt2
#> $lt2[[1]]
#> torch_tensor
-#> 2.3873
-#> 0.8665
-#> -1.5042
-#> -0.9010
+#> 0.4685
+#> -0.6564
+#> 0.0766
+#> -1.2989
#> [ CPUFloatType{4} ]
#>
#> $lt2[[2]]
#> torch_tensor
-#> 0.2335
-#> 0.4423
-#> 0.3253
-#> 1.1769
+#> 0.6419
+#> -0.0460
+#> 0.7914
+#> -0.7039
#> [ CPUFloatType{4} ]
#>
#> $lt2[[3]]
#> torch_tensor
-#> 0.01 *
-#> -7.8032
-#> 2.8893
-#> -10.5455
-#> -103.9160
+#> -0.6416
+#> -0.1101
+#> 1.8043
+#> -0.1597
#> [ CPUFloatType{4} ]
#>
#> $lt2[[4]]
#> torch_tensor
-#> 1.2430
-#> 1.1421
-#> 0.3086
-#> -1.8605
+#> 0.1335
+#> -1.1284
+#> -0.7767
+#> 1.8633
#> [ CPUFloatType{4} ]
#>
#> $lt2[[5]]
#> torch_tensor
-#> 0.3941
-#> -1.5138
-#> 0.8910
-#> 0.5415
+#> -0.3096
+#> 0.4865
+#> -0.9504
+#> -0.4357
#> [ CPUFloatType{4} ]
#>
#> $lt2[[6]]
#> torch_tensor
-#> -2.3946
-#> -0.5953
-#> 0.3587
-#> 0.7571
+#> 1.1612
+#> 1.5158
+#> 0.9482
+#> 0.3363
#> [ CPUFloatType{4} ]
#>
#> $lt2[[7]]
#> torch_tensor
-#> -0.5688
-#> -0.5727
-#> 2.1377
-#> 1.0852
+#> 0.9708
+#> 0.1084
+#> -0.8600
+#> -0.1317
#> [ CPUFloatType{4} ]
#>
#> $lt2[[8]]
#> torch_tensor
-#> 0.2346
-#> -2.8475
-#> 0.4795
-#> -0.0282
+#> 1.5243
+#> 1.3771
+#> 0.3371
+#> 0.6340
#> [ CPUFloatType{4} ]
#>
#> $lt2[[9]]
#> torch_tensor
-#> 1.2866
-#> 0.4012
-#> -1.1580
-#> 0.4107
+#> -1.4071
+#> -0.3108
+#> 0.3162
+#> 1.9051
#> [ CPUFloatType{4} ]
#>
#> $lt2[[10]]
#> torch_tensor
-#> 1.6895
-#> 2.4545
-#> 0.5864
-#> 0.0007
+#> -1.5462
+#> 0.1936
+#> 0.0976
+#> -1.5574
#> [ CPUFloatType{4} ]
#>
#>
diff --git a/dev/reference/mlr_callback_set.progress.html b/dev/reference/mlr_callback_set.progress.html
index 139dfde0..ae6f35d0 100644
--- a/dev/reference/mlr_callback_set.progress.html
+++ b/dev/reference/mlr_callback_set.progress.html
@@ -184,7 +184,7 @@ Examples)
learner$train(task)
-#> Epoch 1 started (2025-02-07 11:58:22)
+#> Epoch 1 started (2025-02-08 11:18:56)
#>
#> [Summary epoch 1]
#> ------------------
@@ -193,7 +193,7 @@ Examples#> * classif.ce = 0.69
#> Measures (Valid):
#> * classif.ce = 0.62
-#> Epoch 2 started (2025-02-07 11:58:22)
+#> Epoch 2 started (2025-02-08 11:18:56)
#>
#> [Summary epoch 2]
#> ------------------
@@ -202,7 +202,7 @@ Examples#> * classif.ce = 0.69
#> Measures (Valid):
#> * classif.ce = 0.56
-#> Epoch 3 started (2025-02-07 11:58:23)
+#> Epoch 3 started (2025-02-08 11:18:57)
#>
#> [Summary epoch 3]
#> ------------------
@@ -211,7 +211,7 @@ Examples#> * classif.ce = 0.45
#> Measures (Valid):
#> * classif.ce = 0.44
-#> Epoch 4 started (2025-02-07 11:58:23)
+#> Epoch 4 started (2025-02-08 11:18:57)
#>
#> [Summary epoch 4]
#> ------------------
@@ -220,7 +220,7 @@ Examples#> * classif.ce = 0.43
#> Measures (Valid):
#> * classif.ce = 0.49
-#> Epoch 5 started (2025-02-07 11:58:24)
+#> Epoch 5 started (2025-02-08 11:18:58)
#>
#> [Summary epoch 5]
#> ------------------
@@ -229,7 +229,7 @@ Examples#> * classif.ce = 0.49
#> Measures (Valid):
#> * classif.ce = 0.60
-#> Finished training for 5 epochs (2025-02-07 11:58:24)
+#> Finished training for 5 epochs (2025-02-08 11:18:58)