1 #pragma once 2 3 #include <ATen/core/TensorBase.h> 4 #include <c10/core/Device.h> 5 #include <torch/csrc/jit/mobile/module.h> 6 #include <optional> 7 8 #include <istream> 9 #include <map> 10 #include <string> 11 12 namespace torch::jit { 13 14 /** 15 * Loads named parameters from the serialized data in @p in. 16 * 17 * Calls #TORCH_CHECK() if the data format is not recognized. 18 */ 19 TORCH_API std::map<std::string, at::Tensor> _load_parameters( 20 std::istream& in, 21 std::optional<at::Device> device = std::nullopt); 22 23 /** 24 * Loads named parameters from the serialized data in @p filename. 25 * 26 * Calls #TORCH_CHECK() if the data format is not recognized. 27 */ 28 TORCH_API std::map<std::string, at::Tensor> _load_parameters( 29 const std::string& filename, 30 std::optional<at::Device> device = std::nullopt); 31 32 // NOTE: Please prefer using _load_parameters over using the function below. 33 TORCH_API std::map<std::string, at::Tensor> mobile_module_to_parameter_map( 34 const mobile::Module& module); 35 36 } // namespace torch::jit 37