pytorch/torch/csrc/jit/source_range_serialization.h
James Reed ffa15d2285 Load original SourceRanges on import (#22180)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/22180
ghimport-source-id: efa46dcb845c099f0a746f523901ab2c2cd3b004

Test Plan: Imported from OSS

Differential Revision: D15981425

Pulled By: jamesr66a

fbshipit-source-id: bef682bd13c1a5be95bdb97e025690c6f2d523d3
2019-07-01 21:14:39 -07:00

42 lines
741 B
C++

#pragma once
#include <c10/core/Allocator.h>
#include <torch/csrc/jit/source_range.h>
#include <unordered_map>
#include <vector>
namespace c10 {
struct IValue;
}
namespace torch {
namespace jit {
class Pickler;
class SourceRangeSerializer;
class SourceRangeDeserializer;
class SourceRangePickler {
public:
SourceRangePickler();
void pickle(const SourceRangeRecords& ranges);
const std::vector<char>& get_data();
private:
std::shared_ptr<Pickler> p;
std::shared_ptr<SourceRangeSerializer> srs;
};
class SourceRangeUnpickler {
public:
virtual c10::optional<SourceRange> findSourceRangeThatGenerated(
const SourceRange& range) = 0;
virtual ~SourceRangeUnpickler() {}
};
} // namespace jit
} // namespace torch