Rate this Page

Struct AnyModulePlaceholder#

Inheritance Relationships#

Base Type#

  • public torch::nn::AnyValue::Placeholder

Derived Type#

Struct Documentation#

struct AnyModulePlaceholder : public torch::nn::AnyValue::Placeholder#

The static type of the object we store in the AnyModule, which erases the actual type, but allows us to call forward() on the underlying module.

Subclassed by torch::nn::AnyModuleHolder< ModuleType, ArgumentTypes >

Public Functions

virtual AnyValue forward(std::vector<AnyValue> &&arguments) = 0#

The “erased” forward() method.

virtual std::shared_ptr<Module> ptr() = 0#

Returns std::shared_ptr<Module> pointing to the erased module.

virtual std::unique_ptr<AnyModulePlaceholder> copy() const = 0#

Returns a AnyModulePlaceholder with a shallow copy of this AnyModule.

virtual std::unique_ptr<AnyModulePlaceholder> clone_module(std::optional<Device> device) const = 0#

Returns a AnyModulePlaceholder with a deep copy of this AnyModule.