control_py_env {mafR}R Documentation

Python controls

Description

Interface to control variables in a Python environment possibly used by Infusion. Currently the only implemented control is that of the torch random seed.

Usage

control_py_env(py_handle, seed = NULL)

Arguments

py_handle

An R environment that provides access to a Python evaluation environment, as produced by get_py_MAF_handle

seed

Numeric: passed (as integer value) to torch.random.manual_seed.

Value

Returns NULL invisibly.

Examples

## Initialization of Python session:
my_env <- list2env(list(is_set=FALSE),parent = emptyenv())
py_handle <- get_py_MAF_handle(my_env, reset=FALSE, torch_device="cpu")

if (inherits(py_handle,"environment"))  control_py_env(py_handle, seed=0L)

[Package mafR version 1.1.6 Index]