Files
pytorch/torch/csrc/jit/serialization/python_print.h
Peter Bell b2e79ed5ec Remove WindowsTorchApiMacro.h in favor of Export.h (#69585)
Summary:
Follow up to https://github.com/pytorch/pytorch/issues/68095

This also changes the files from the ATen folder to include c10's `Export.h` instead since they can't ever be exporting `TORCH_PYTHON_API`.

cc pietern mrshenli pritamdamania87 zhaojuanmao satgera rohan-varma gqchen aazzolini osalpekar jiayisuse SciPioneer H-Huang

Pull Request resolved: https://github.com/pytorch/pytorch/pull/69585

Reviewed By: mrshenli

Differential Revision: D32958594

Pulled By: albanD

fbshipit-source-id: 1ec7ef63764573fa2b486928955e3a1172150061
2021-12-09 17:30:09 -08:00

54 lines
1.1 KiB
C++

#pragma once
#include <torch/csrc/Export.h>
#include <torch/csrc/jit/ir/ir.h>
#include <iostream>
#include <vector>
namespace torch {
namespace jit {
struct Method;
struct Module;
struct PythonPrintImpl;
struct PrintDepsTable {
void add(const c10::NamedTypePtr& type);
size_t size() const {
return table_.size();
}
const c10::NamedTypePtr& operator[](size_t index) const {
return table_[index];
}
private:
std::vector<c10::NamedTypePtr> table_;
std::unordered_set<c10::NamedTypePtr> non_unique_;
};
struct TORCH_API PythonPrint {
PythonPrint(
std::vector<IValue>& constant_table,
PrintDepsTable& deps_table,
c10::TypePrinter type_printer = nullptr,
bool enforce_importable = false);
void printNamedType(const c10::NamedTypePtr& classType);
void printFunction(const Function& callee);
void printMethod(const Function& callee);
std::string str() const;
const SourceRangeRecords& ranges() const;
uint64_t minVersion() const;
~PythonPrint();
private:
std::shared_ptr<PythonPrintImpl> pImpl;
};
TORCH_API bool printerHasSpecialCaseFor(c10::Symbol sym);
} // namespace jit
} // namespace torch