Template Struct AnyModuleHolder¶
Defined in File any_module_holder.h
Page Contents
Nested Relationships¶
Inheritance Relationships¶
Base Type¶
public torch::nn::AnyModulePlaceholder
(Struct AnyModulePlaceholder)
Struct Documentation¶
-
template<typename ModuleType, typename ...ArgumentTypes>
struct AnyModuleHolder : public torch::nn::AnyModulePlaceholder¶ The dynamic type of the object stored in the
AnyModule
.It contains the concrete instance to which all calls are forwarded. It is parameterized over the concrete type of the module, and the types of the arguments the module takes in its
forward()
method.Public Functions
Constructs the
AnyModuleHolder
from a concrete module.
-
inline virtual AnyValue forward(std::vector<AnyValue> &&arguments) override¶
Calls
forward()
on the underlying module, casting eachAnyValue
in the argument vector to a concrete value.
-
inline virtual std::shared_ptr<Module> ptr() override¶
Returns std::shared_ptr<Module> pointing to the erased module.
-
inline virtual std::unique_ptr<AnyModulePlaceholder> copy() const override¶
Returns a
AnyModulePlaceholder
with a shallow copy of thisAnyModule
.
-
inline virtual std::unique_ptr<AnyModulePlaceholder> clone_module(std::optional<Device> device) const override¶
Returns a
AnyModulePlaceholder
with a deep copy of thisAnyModule
.
Public Members
-
std::shared_ptr<ModuleType> module¶
The actual concrete module instance.
-
struct CheckedGetter¶
-
struct InvokeForward¶
-
Public Members
-
std::shared_ptr<ModuleType> &module_¶
-
std::shared_ptr<ModuleType> &module_¶