1#pragma once
2
3#include <tuple>
4#include <unordered_map>
5
6#include <ATen/core/function_schema.h>
7#include <ATen/core/ivalue.h>
8#include <ATen/core/jit_type.h>
9#include <ATen/core/qualified_name.h>
10#include <torch/csrc/jit/backends/backend_debug_handler.h>
11#include <torch/csrc/jit/mobile/function.h>
12#include <torch/csrc/jit/mobile/module.h>
13#include <torch/csrc/jit/runtime/interpreter.h>
14#include <torch/csrc/jit/serialization/type_name_uniquer.h>
15
16namespace torch {
17namespace jit {
18
19struct TORCH_API CompilationOptions {
20 bool incl_interface_call = false;
21 bool enable_default_value_for_unspecified_arg = false;
22 bool enable_default_args_before_out_args = true;
23 bool enable_emit_promoted_ops = true;
24 int model_version = caffe2::serialize::kProducedBytecodeVersion;
25};
26
27TORCH_API mobile::Module jitModuleToMobile(
28 const Module& module,
29 const CompilationOptions& options);
30
31mobile::Code compileGraphToMobileCode(
32 const std::string& name,
33 const std::shared_ptr<Graph>& graph,
34 const CompilationOptions& compilation_options,
35 BackendDebugInfoRecorder& debug_info_recorder);
36
37TORCH_API std::unique_ptr<mobile::Function> convertJitFunctionToMobileFunction(
38 const GraphFunction& function,
39 const CompilationOptions& options);
40
41TORCH_API IValue convertMobileFunctionToCodeTable(
42 const mobile::Function& func,
43 const CompilationOptions& compilation_options);
44
45} // namespace jit
46} // namespace torch
47