schnetpack.transform
Transforms are applied before and/or after the model. They can be used, e.g., for calculating neighbor lists, casting, unit conversion or data augmentation. Some can applied before batching, i.e. to single systems, when loading the data. This is necessary for pre-processing and includes neighbor lists, for example. On the other hand, transforms need to be able to handle batches for post-processing. The flags is_postprocessor and is_preprocessor indicate how the tranforms may be used. The attribute mode of a transform is set automatically to either “pre” or “post”.q
- class transform.Transform(*args: Any, **kwargs: Any)[source]
Base class for all transforms. The base class ensures that the reference to the data and datamodule attributes are initialized. Transforms can be used as pre- or post-processing layers. They can also be used for other parts of a model, that need to be initialized based on data.
To implement a new transform, override the forward method. Preprocessors are applied to single examples, while postprocessors operate on batches. All transforms should return a modified inputs dictionary.
Casting
Cast all inputs according to type map. |
|
Cast all float64 tensors to float32 |
|
Cast all float32 tensors to float64 |