Template Function torch::nn::parallel::replicate(const std::shared_ptr<ModuleType>&, const std::vector<Device>&)

Function Documentation

template<typename ModuleType>
std::vector<std::shared_ptr<ModuleType>> torch::nn::parallel::replicate(const std::shared_ptr<ModuleType> &module, const std::vector<Device> &devices)

Replicates a module on the given list of devices.

A replica is created by calling clone() on the module. For this, the module must inherit from nn::Cloneable, or define its own clone() method, which is expected to perform a deep copy of the module.


Access comprehensive developer documentation for PyTorch

View Docs


Get in-depth tutorials for beginners and advanced developers

View Tutorials


Find development resources and get your questions answered

View Resources