Skip to contents

Repeat a block n_blocks times.

Parameters

The parameters available for the block itself, as well as

  • n_blocks :: integer(1)
    How often to repeat the block.

Input and Output Channels

The PipeOp sets its input and output channels to those from the block (Graph) it received during construction.

State

The state is the value calculated by the public method $shapes_out().

Credit

Part of this documentation have been copied or adapted from the documentation of torch.

Super classes

mlr3pipelines::PipeOp -> mlr3torch::PipeOpTorch -> PipeOpTorchBlock

Active bindings

block

(Graph)
The neural network segment that is repeated by this PipeOp.

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage

PipeOpTorchBlock$new(block, id = "nn_block", param_vals = list())

Arguments

block

(Graph)
A graph consisting primarily of PipeOpTorch objects that is to be repeated.

id

(character(1))
The id for of the new object.

param_vals

(named list())
Parameter values to be set after construction.


Method clone()

The objects of this class are cloneable with this method.

Usage

PipeOpTorchBlock$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

block = po("nn_linear") %>>% po("nn_relu")
po_block = po("nn_block", block,
nn_linear.out_features = 10L, n_blocks = 3)
network = po("torch_ingress_num") %>>%
po_block %>>%
po("nn_head") %>>%
po("torch_loss", t_loss("cross_entropy")) %>>%
po("torch_optimizer", t_opt("adam")) %>>%
po("torch_model_classif",
  batch_size = 50,
  epochs = 3)

task = tsk("iris")
network$train(task)
#> $torch_model_classif.output
#> NULL
#>