mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 00:21:07 +01:00
Additionally: - add support for calling functions that are not methods in the Python frontend - add an end-to-end test for the Python frontend - add a capture_stdout helper for checking that `print` actually works
29 lines
626 B
C++
29 lines
626 B
C++
#pragma once
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
#include "torch/csrc/jit/ir.h"
|
|
#include "torch/csrc/jit/script/tree_views.h"
|
|
|
|
namespace torch {
|
|
namespace jit {
|
|
namespace script {
|
|
|
|
struct CompilationUnitImpl;
|
|
struct CompilationUnit {
|
|
CompilationUnit();
|
|
void define(const std::string& source);
|
|
void defineFunction(const Def& def);
|
|
std::shared_ptr<Graph> getGraph(const std::string& func_name);
|
|
~CompilationUnit();
|
|
|
|
private:
|
|
std::unique_ptr<CompilationUnitImpl> pImpl;
|
|
};
|
|
|
|
std::unique_ptr<CompilationUnit> jitScriptCompile(const std::string& script);
|
|
|
|
} // namespace script
|
|
} // namespace jit
|
|
} // namespace torch
|