NEML2 2.0.0
|
#include <TensorCache.h>
Public Member Functions | |
TensorCache (std::function< Tensor(const TensorOptions &)> &&) | |
Construct a new Tensor Cache object. | |
const Tensor & | operator() (const TensorOptions &) |
Get the tensor with the given tensor options. If the tensor does not exist in the cache, it is created. | |
TensorCache | ( | std::function< Tensor(const TensorOptions &)> && | creator | ) |
Construct a new Tensor Cache object.
The constructor takes a lambda that creates a tensor given a set of tensor options. The lambda is invoked upon a cache miss.
const Tensor & operator() | ( | const TensorOptions & | opt | ) |
Get the tensor with the given tensor options. If the tensor does not exist in the cache, it is created.