Struct Module¶
Defined in File module.h
Page Contents
Struct Documentation¶
-
struct Module : public Object¶
Public Functions
-
explicit Module(c10::QualifiedName class_name)¶
-
Module() = default¶
-
~Module() = default¶
-
inline void set_optimized(bool o)¶
-
inline bool is_optimized() const¶
-
inline IValue forward(std::vector<IValue> inputs, const Kwargs &kwargs = Kwargs())¶
-
inline void register_attribute(const std::string &name, const TypePtr &t, IValue v, bool is_param = false, bool is_buffer = false)¶
-
buffer_list buffers(bool recurse = true) const¶
-
named_buffer_list named_buffers(bool recurse = true) const¶
-
module_list children() const¶
-
named_module_list named_children() const¶
-
module_list modules() const¶
-
named_module_list named_modules() const¶
-
parameter_list parameters(bool recurse = true) const¶
-
named_parameter_list named_parameters(bool recurse = true) const¶
-
attribute_list attributes(bool recurse = true) const¶
-
named_attribute_list named_attributes(bool recurse = true) const¶
-
void dump(bool print_method_bodies, bool print_attr_values, bool print_param_values) const¶
-
std::string dump_to_str(bool print_method_bodies, bool print_attr_values, bool print_param_values) const¶
-
void train(bool on = true)¶
Enables “training” mode.
-
inline void eval()¶
Calls train(false) to enable “eval” mode.
Do not override this method, override
train()
instead.
-
inline bool is_training() const¶
True if the module is in training mode.
-
void to(at::Device device, at::ScalarType dtype, bool non_blocking = false)¶
Recursively casts all parameters to the given
dtype
anddevice
.If
non_blocking
is true and the source is in pinned memory and destination is on the GPU or vice versa, the copy is performed asynchronously with respect to the host. Otherwise, the argument has no effect.
-
void to(at::ScalarType dtype, bool non_blocking = false)¶
Recursively casts all parameters to the given dtype.
If
non_blocking
is true and the source is in pinned memory and destination is on the GPU or vice versa, the copy is performed asynchronously with respect to the host. Otherwise, the argument has no effect.
-
void to(at::Device device, bool non_blocking = false)¶
Recursively moves all parameters to the given device.
If
non_blocking
is true and the source is in pinned memory and destination is on the GPU or vice versa, the copy is performed asynchronously with respect to the host. Otherwise, the argument has no effect.
-
void save(std::ostream &out, const ExtraFilesMap &extra_files = ExtraFilesMap()) const¶
-
void save(const std::string &filename, const ExtraFilesMap &extra_files = ExtraFilesMap()) const¶
-
void _save_for_mobile(std::ostream &out, const ExtraFilesMap &extra_files = ExtraFilesMap(), bool save_mobile_debug_info = false, bool use_flatbuffer = false) const¶
-
void _save_for_mobile(const std::string &filename, const ExtraFilesMap &extra_files = ExtraFilesMap(), bool save_mobile_debug_info = false, bool use_flatbuffer = false) const¶
-
Module clone(bool inplace, const std::unordered_set<std::string> &ignored_method, const std::unordered_set<std::string> &ignored_attributes) const¶
-
IValue operator()(std::vector<IValue> inputs)¶
-
template<typename ...Types>
inline IValue create_class(const c10::QualifiedName &name, Types&&... args) const¶
-
IValue create_class(const c10::QualifiedName &name, Stack stack) const¶
-
inline void store_traced_inputs(std::string func_name, std::vector<IValue> inputs)¶
-
explicit Module(c10::QualifiedName class_name)¶