forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimport.h
40 lines (31 loc) · 1.26 KB
/
import.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once
#include <torch/csrc/jit/ir.h>
#include <torch/csrc/jit/script/module.h>
#include <istream>
namespace torch {
namespace jit {
using ModuleLookup = std::function<std::shared_ptr<script::Module>(
const std::vector<std::string>&)>;
TORCH_API void import_ir_module(
ModuleLookup module_lookup,
const std::string& filename,
c10::optional<c10::Device> device = c10::nullopt);
TORCH_API void import_ir_module(
ModuleLookup module_lookup,
std::istream& in,
c10::optional<c10::Device> device = c10::nullopt);
/// Loads a serialized `script::Module` from the given `istream`.
///
/// The istream must contain a serialized `script::Module`, exported via
/// `torch::jit::ExportModule` in C++.
TORCH_API std::shared_ptr<script::Module> load(std::istream& in,
c10::optional<c10::Device> device = c10::nullopt);
/// Loads a serialized `script::Module` from the given `filename`.
///
/// The file stored at the location given in `filename` must contain a
/// serialized `script::Module`, exported either via `ScriptModule.save()` in
/// Python or `torch::jit::ExportModule` in C++.
TORCH_API std::shared_ptr<script::Module> load(const std::string& filename,
c10::optional<c10::Device> device = c10::nullopt);
} // namespace jit
} // namespace torch