Template Class Cloneable¶
Defined in File cloneable.h
Page Contents
Inheritance Relationships¶
Base Type¶
public torch::nn::Module
(Class Module)
Derived Types¶
public torch::nn::NormImplBase< D, Derived, BatchNormOptions >
(Template Class NormImplBase)public torch::nn::NormImplBase< D, Derived, InstanceNormOptions >
(Template Class NormImplBase)public torch::nn::AdaptiveAvgPoolImpl< D, output_size_t, Derived >
(Template Class AdaptiveAvgPoolImpl)public torch::nn::AdaptiveMaxPoolImpl< D, output_size_t, Derived >
(Template Class AdaptiveMaxPoolImpl)public torch::nn::AvgPoolImpl< D, Derived >
(Template Class AvgPoolImpl)public torch::nn::ConstantPadImpl< D, Derived >
(Template Class ConstantPadImpl)public torch::nn::ConvNdImpl< D, Derived >
(Template Class ConvNdImpl)public torch::nn::detail::_DropoutNd< Derived >
(Template Class _DropoutNd)public torch::nn::detail::RNNCellImplBase< Derived >
(Template Class RNNCellImplBase)public torch::nn::detail::RNNImplBase< Derived >
(Template Class RNNImplBase)public torch::nn::LPPoolImpl< D, Derived >
(Template Class LPPoolImpl)public torch::nn::MaxPoolImpl< D, Derived >
(Template Class MaxPoolImpl)public torch::nn::MaxUnpoolImpl< D, Derived >
(Template Class MaxUnpoolImpl)public torch::nn::NormImplBase< D, Derived, DerivedOptions >
(Template Class NormImplBase)public torch::nn::ReflectionPadImpl< D, Derived >
(Template Class ReflectionPadImpl)public torch::nn::ReplicationPadImpl< D, Derived >
(Template Class ReplicationPadImpl)
Class Documentation¶
-
template<typename
Derived
>
classtorch::nn
::
Cloneable
: public virtual torch::nn::Module¶ The
clone()
method in the baseModule
class does not have knowledge of the concrete runtime type of its subclasses.Therefore,
clone()
must either be called from within the subclass, or from a base class that has knowledge of the concrete type.Cloneable
uses the CRTP to gain knowledge of the subclass’ static type and provide an implementation of theclone()
method. We do not want to use this pattern in the base class, because then storing a module would always require templatizing it.Subclassed by torch::nn::NormImplBase< D, Derived, BatchNormOptions >, torch::nn::NormImplBase< D, Derived, InstanceNormOptions >, torch::nn::AdaptiveAvgPoolImpl< D, output_size_t, Derived >, torch::nn::AdaptiveMaxPoolImpl< D, output_size_t, Derived >, torch::nn::AvgPoolImpl< D, Derived >, torch::nn::ConstantPadImpl< D, Derived >, torch::nn::ConvNdImpl< D, Derived >, torch::nn::detail::_DropoutNd< Derived >, torch::nn::detail::RNNCellImplBase< Derived >, torch::nn::detail::RNNImplBase< Derived >, torch::nn::LPPoolImpl< D, Derived >, torch::nn::MaxPoolImpl< D, Derived >, torch::nn::MaxUnpoolImpl< D, Derived >, torch::nn::NormImplBase< D, Derived, DerivedOptions >, torch::nn::ReflectionPadImpl< D, Derived >, torch::nn::ReplicationPadImpl< D, Derived >