xref: /aosp_15_r20/external/pytorch/torch/csrc/api/src/jit.cpp (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #include <torch/jit.h>
2 
3 #include <ATen/core/stack.h>
4 #include <torch/csrc/jit/frontend/ir_emitter.h>
5 
6 #include <memory>
7 #include <string>
8 
9 namespace torch {
10 namespace jit {
11 
compile(const std::string & source)12 std::shared_ptr<CompilationUnit> compile(const std::string& source) {
13   auto module = std::make_shared<CompilationUnit>();
14   module->define(std::nullopt, source, nativeResolver(), nullptr);
15   return module;
16 }
17 
18 } // namespace jit
19 } // namespace torch
20