Warning: This is a prototype library that is actively under development. If you have suggestions or potential use cases that you'd like addressed, please open a Github issue; we welcome any thoughts, feedback, and contributions!
MaskedTensor is a prototype library that is part of the PyTorch project and is an extension of torch.Tensor
that provides the ability to mask out the value for any given element. Elements with masked out values are ignored during computation and give the user access to advanced semantics such as masked reductions, safe softmax, masked matrix multiplication, filtering NaNs, and masking out certain gradient values.
To install the official MaskedTensor via pip, use the following command:
pip install maskedtensor
For the dev (unstable) nightly version that contains the most recent features, please replace maskedtensor
with maskedtensor-nightly
.
Note that MaskedTensor requires PyTorch >= 1.11, which you can get on the the main website
To install from source, you will need Python 3.7 or later, and we highly recommend that you use an Anaconda environment. Then run:
python setup.py develop
Please find documentation on the MaskedTensor Website.
Please follow the instructions in the docs README.
For an introduction and instructions on how to use MaskedTensors and what they are useful for, there are a nubmer of tutorials on the MaskedTensor website.
maskedtensor is licensed under BSD 3-Clause