Defined in File serializer.h
load graph from megbrain dump file
Each GraphLoader instance can create multiple graphs, but all the created graphs share underlying params (i.e. values for SharedDeviceTensor are shared)
mem_node => tensor_value
tensor_id => (tensor_name, (mem_node => tensor_value))
Since tensor IDs are guaranteed to be consecutive, a vector is used to implement the map.
Either all tensor names are empty, or they are guaranteed to be distinct non-empty strings at dump time.
tensor_name => SharedTensorMapEntry
reset underlying input file from which further load() would read
This method can be used to release the currently owned file to the caller.
original input file that is currently used
file: new input file, can be null
create a new graph instance; not thread safe
rewind: whether to call InputFile::rewind before loading
get mapping from tensor ID to device tensor shared between instances
The shared tensors are usually used as model params in a machine learning context. For each param name, the returned value has a map from a memory node to the first param loaded on that mem node
helper for constructing SharedTensorNameMap from SharedTensorIDMap
Public Static Functions
expliit dtor decl to reduce binary size
call graph->compile() but also checks for comp seq rec
graph would be destructed if comp_node_seq_record_level == 2; this method should be called in favor of graph->compile().
name to host tensor used in this graph, usually for input tensors
name to output var nodes specified during serializing
map from original id to loaded output vars
original output vars in the order passed to GraphDumper::dump