Chapter 7 Creating PyTorch classes

Last update: Thu Oct 22 16:46:28 2020 -0500 (54a46ea04)

7.1 Build a PyTorch model class

PyTorch classes cannot not directly be instantiated from R. Yet. We need an intermediate step to create a class. For this, we use reticulate functions like py_run_string() that will read the class implementation in Python code, and then assign it to an R object.