Caffe2 - C++ API
A deep learning, cross platform ML framework
Public Member Functions | Static Public Member Functions | Data Fields
torch::jit::PythonPrintPass Struct Reference

Public Member Functions

void addToClassTable (const ClassTypePtr &classType)
bool canInline (Value *v)
NodescanValue (Node *block_point, Value *v)
NodepreviousNonConstant (Node *n)
NodescanNode (Node *n)
void scanBlock (Block *b)
size_t getOrAddTensorConstant (at::Tensor t)
void buildConstantList (Node *n, std::vector< Node * > &constants)
void buildConstantList (Block *b, std::vector< Node * > &constants)
std::string genNameImpl (const std::string &candidate, std::unordered_set< std::string > &used)
std::string genName (const std::string &candidate)
std::string genMethodName (const std::string &candidate)
std::string genUniqueNameFor (Value *v)
std::string useOf (Value *v) const
void assignValue (Value *v, const std::string &s)
void assignValue (Value *v, Value *w)
void assignValuesToTheirUniqueNames (at::ArrayRef< Value * > values)
std::ostream & indent ()
ResourceGuard WithIndented ()
template<class T0 , class T1 , class F >
void zipWith (at::ArrayRef< T0 > list_a, at::ArrayRef< T1 > list_b, F action) const
void printValueList (std::ostream &stmt, at::ArrayRef< Value * > list, const char *begin="", const char *end="")
void printDict (std::ostream &stmt, at::ArrayRef< Value * > key_value_pairs, const char *begin="{", const char *end="}")
void printAssignment (at::ArrayRef< Value * > lhs, at::ArrayRef< Value * > rhs)
void printIf (IfView stmt)
void printLoop (LoopView stmt)
bool isLongLine (const std::string &str)
bool isLongInline (Node *node)
bool isNonConstantInline (Value *input)
void splitLongInlines (at::ArrayRef< Value * > inputs)
 and it is important that we un-inline all the inputs preceeding the long input:
void printOutputDefinition (Node *node, const std::string &str)
void registerClassDependencies (const TypePtr &type)
void printNode (Node *node, bool print_const)
void printMaybeAnnotatedConstantList (std::ostream &stmt, const char *the_type, size_t list_size, const IValue &the_list)
void printConstant (std::ostream &stmt, const IValue &v)
void printNone (std::ostream &stmt, const Node *node)
void printRHS (std::ostream &stmt, Node *node)
std::ostream & printBlock (Block *root, bool block_has_other_statements)
void printDefaultValue (const TypePtr &typ, std::ostream &stmt, const IValue &value)
void printFunctionDefinition (Graph &graph, const std::string &name, bool is_class=false, const std::vector< c10::optional< IValue >> &defaults={}, const std::vector< std::string > &param_names={})
 PythonPrintPass (std::ostream &out_, std::vector< at::Tensor > &tensor_table, std::vector< ClassTypePtr > &class_table, bool enforce_importable)
TypePtr resultType (const Graph &graph)
void printFunction (Graph &graph, const std::string &name, bool is_class, const std::vector< c10::optional< IValue >> &defaults={}, const std::vector< std::string > &param_names={})
void printMethod (script::Method &method)
void printMethod (script::Method &method, bool is_class, const std::unordered_map< IValue *, QualifiedNamePtr > &extra_ivalue_names)
void printModule (script::Module &module)
void printClass (const ClassTypePtr &classType)

Static Public Member Functions

static std::string makeValidIdentifier (const std::string &candidate)
static bool shouldEmitAsForLoop (LoopView stmt)

Data Fields

std::ostream & out
std::vector< at::Tensor > & tensor_table_
std::vector< ClassTypePtr > & class_table_
std::unordered_set< Node * > output_inline_
bool enforce_importable_
std::unordered_set< std::string > used_names_
std::unordered_set< std::string > used_method_names_
std::vector< std::function< void(void)> > worklist
std::unordered_set< Node * > seen_constants
std::unordered_map< std::string, size_t > next_id
std::unordered_map< Value *, std::string > value_names_
size_t level = 0

Detailed Description

Definition at line 200 of file python_print.cpp.

The documentation for this struct was generated from the following file: