blob: 8a2517dea88058d0c2e18a824a48e672398a82d7 [file] [log] [blame]
erik.andersson@arm.comad45f792021-02-03 10:20:16 +01001# Copyright (C) 2020-2021 Arm Limited or its affiliates. All rights reserved.
Tim Hall79d07d22020-04-27 18:20:16 +01002#
3# SPDX-License-Identifier: Apache-2.0
4#
5# Licensed under the Apache License, Version 2.0 (the License); you may
6# not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an AS IS BASIS, WITHOUT
13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
Tim Hall79d07d22020-04-27 18:20:16 +010016# Description:
17# Neural network graph classes and enums.
18# Pass - A packed pass containing one or more Operations.
19# CascadedPass - A scheduled pass containing one or more Passes, as well as a scheduling strategy and block
20# configurations.
21# Subgraph - Holds a neural network subgraph, pointing at Tensors, Operations, Passes, and CascadedPasses.
22# Graph - A full neural network graph with one or more Subgraphs.
Tim Hall79d07d22020-04-27 18:20:16 +010023import enum
patrik.gustavssoneeb85152020-12-21 17:10:40 +000024from typing import List
Tim Hall79d07d22020-04-27 18:20:16 +010025
Louis Verhaardaee5d752020-09-30 09:01:52 +020026from .operation import Op
patrik.gustavssoneeb85152020-12-21 17:10:40 +000027from .shape4d import Shape4D
Louis Verhaardaee5d752020-09-30 09:01:52 +020028
Tim Hall79d07d22020-04-27 18:20:16 +010029
30class PassPlacement(enum.Enum):
31 Unknown = 0
32 Cpu = 1
33 Npu = 2
34 MemoryOnly = 3
35 StartupInit = 4
36
37
38class TensorAllocator(enum.Enum):
39 LinearAlloc = 1
40 Greedy = 2
Louis Verhaardd7002522021-01-20 17:23:54 +010041 HillClimb = 3
Tim Hall79d07d22020-04-27 18:20:16 +010042
43 def __str__(self):
44 return self.name
45
46
Patrik Gustavsson8f1f9aa2021-06-28 07:41:58 +020047class NetworkType(enum.Enum):
48 TFLite = 1
49 TOSA = 2
50
51
Tim Hall79d07d22020-04-27 18:20:16 +010052class Pass:
53 def __init__(self, name, placement, is_element_wise, npu_block_type):
54 self.inputs = []
55 self.intermediates = []
56 self.outputs = []
57 self.ops = []
58 self.primary_op = None
59 self.ifm_tensor = None
60 self.ifm2_tensor = None
61 self.ofm_tensor = None
62 self.weight_tensor = None
63 self.scale_tensor = None
Fredrik Svedberga0c36242020-06-03 15:43:31 +020064 self.lut_tensor = None
Tim Hall79d07d22020-04-27 18:20:16 +010065 self.name = name
66 self.cascade = None
67 self.placement = placement
patrik.gustavssoneeb85152020-12-21 17:10:40 +000068 self.ifm_shapes: List[Shape4D] = []
69 self.ofm_shapes: List[Shape4D] = []
Tim Hall79d07d22020-04-27 18:20:16 +010070
71 # TODO: rename is_element_wise because it is not the same as an ElementWise operator. It is used by the tensor
72 # allocation and requires that the OFM and IFM has the exact same address. Essentially complete overlap.
73 self.is_element_wise = is_element_wise
74 self.npu_block_type = npu_block_type
75 self.block_config = None # will be filled in by scheduler
76 self.shared_buffer = None # will be filled in by scheduler
Tim Halld8339a72021-05-27 18:49:40 +010077 self.scheduling_info = None # will be filled in by scheduler
Tim Hall79d07d22020-04-27 18:20:16 +010078
79 self.predecessors = []
80 self.successors = []
81
82 def __str__(self):
83 return "<nng.Pass '%s', %s, ops=%s>" % (self.name, self.placement, [op.type for op in self.ops])
84
85 __repr__ = __str__
86
87 def get_primary_op_ifm_weights(self):
88 if not self.primary_op:
89 return None, None
90 return self.primary_op.get_ifm_ifm2_weights_ofm()[::2]
91
92 def get_primary_op_ifm_ifm2_weights_ofm(self):
93 if not self.primary_op:
94 return None, None, None, None
95 return self.primary_op.get_ifm_ifm2_weights_ofm()
96
97 def get_primary_op_ifm_weights_biases_ofm(self):
98 if not self.primary_op:
99 return None, None, None, None
100 return self.primary_op.get_ifm_weights_biases_ofm()
101
Fredrik Svedberga0c36242020-06-03 15:43:31 +0200102 def get_primary_op_lut(self):
103 if not self.primary_op:
104 return None
105 return self.primary_op.activation_lut
106
Tim Hall79d07d22020-04-27 18:20:16 +0100107
108class SchedulingStrategy(enum.Enum):
109 Unknown = -1
110 IfmStream = 0
111 WeightStream = 1
112
113
114class SchedulerRewrite(enum.Enum):
115 Nop = 0
116 ChangeTensorSubPurpose = 1
117
118
119class CascadedPass:
120 def __init__(self, name, strat, inputs, intermediates, outputs, passes, placement, is_element_wise):
121 self.name = name
122 self.strategy = strat
123 self.inputs = inputs
124 self.intermediates = intermediates
125 self.outputs = outputs
126 self.passes = passes
127 self.placement = placement
128 self.is_element_wise = is_element_wise
129
130 self.predecessors = []
131 self.successors = []
Tim Halld8339a72021-05-27 18:49:40 +0100132 self.sram_used = 0
Tim Hall79d07d22020-04-27 18:20:16 +0100133
134 def __str__(self):
135 return "<nng.CascadedPass strategy=%s x %s '%s', passes=%s, block_configs=%s>" % (
136 self.strategy,
137 len(self.passes),
138 self.name,
139 [ps.name for ps in self.passes],
140 [ps.block_config for ps in self.passes],
141 )
142
143 __repr__ = __str__
144
145
146class Subgraph:
147 def __init__(self, name="<unnamed>", placement=PassPlacement.Cpu):
148 self.output_tensors = []
149 self.input_tensors = []
150 self.original_inputs = [] # Preserve the original input order
151 self.passes = []
152 self.cascaded_passes = []
153 self.name = name
154 self.high_level_command_stream = []
155 self.placement = placement
156 self.command_stream_tensor = None
157 self.flash_tensor = None
Louis Verhaard0b9c9a32020-09-15 14:05:38 +0200158 # Scratch information locally used in the scheduler
Tim Halld8339a72021-05-27 18:49:40 +0100159 self.schedule = None
160 self.sched_ops = []
161
erik.andersson@arm.comad45f792021-02-03 10:20:16 +0100162 self.generated_stream_id = None
Tim Hall79d07d22020-04-27 18:20:16 +0100163
164 self.memory_used = {}
Patrik Gustavssoneca2e952020-05-27 09:15:11 +0200165 self.memory_used_per_type = {}
Tim Hall79d07d22020-04-27 18:20:16 +0100166
167 def __str__(self):
168 return "<nng.Subgraph '%s', n_passes=%d, n_cascaded_passes=%d>" % (
169 self.name,
170 len(self.passes),
171 len(self.cascaded_passes),
172 )
173
174 __repr__ = __str__
175
176 def update_consumers(self):
177 visit_op_set = set()
178 visit_tensor_set = set()
179 self.input_tensors = []
180
181 print_visit = False
182
183 def visit_op(op):
184 if op in visit_op_set:
185 return
186
187 visit_op_set.add(op)
188 for inp in op.inputs:
Jacob Bohlin67e0d8f2020-08-20 10:53:02 +0200189 if not inp:
190 continue
Tim Hall79d07d22020-04-27 18:20:16 +0100191 if print_visit:
192 print(inp, "adding consumer", op)
193 visit_tensor(inp)
194 inp.consumer_list.append(op)
195
Michael McGeaghf3e3ad72020-12-02 12:39:03 +0000196 if op.type in (Op.Placeholder, Op.SubgraphInput):
Tim Hall79d07d22020-04-27 18:20:16 +0100197 assert len(op.outputs) == 1
198 self.input_tensors.append(op.outputs[0])
199
200 for out in op.outputs:
201 if out not in visit_tensor_set:
202 out.consumer_list = [] # reset unvisited output, just in case
203
204 def visit_tensor(tens):
205 if tens in visit_tensor_set:
206 return
207 visit_tensor_set.add(tens)
208 tens.consumer_list = []
209 for op in tens.ops:
210 visit_op(op)
211
212 for ps in self.passes:
213 for tens in ps.outputs + ps.inputs:
Jacob Bohlin67e0d8f2020-08-20 10:53:02 +0200214 if not tens:
215 continue
Tim Hall79d07d22020-04-27 18:20:16 +0100216 tens.consumer_list = [] # reset unvisited tensors to start with
217
218 for tens in self.output_tensors:
219 visit_tensor(tens)
220 tens.consumer_list.append(None) # special op to indicate that the graph consumes the result
221
222 print_visit = True
223 for ps in self.passes:
224 for op in ps.ops:
225 visit_op(op)
226 for tens in ps.inputs:
227 visit_tensor(tens)
228
229 def build_pass_links(self):
230 for idx, ps in enumerate(self.passes):
231 ps.time = 2 * idx
232 ps.predecessors = []
233 ps.successors = []
234
235 for ps in self.passes:
236 for tens in ps.inputs:
237 for op in tens.ops:
238 pred_pass = op.scheduled_pass
239 assert pred_pass.time < ps.time
240 if ps not in pred_pass.successors:
241 pred_pass.successors.append(ps)
242
243 if pred_pass not in ps.predecessors:
244 ps.predecessors.append(pred_pass)
245
246 assert tens in pred_pass.outputs
247
248 def build_pass_dag_predecessors(self):
249 for ps in self.passes:
250 ps.dag_predecessors = []
251
252 class State(enum.Enum):
253 NotVisited = 0
254 BeingVisited = 1
255 Visited = 2
256
257 pass_visit_dict = {}
258
259 def visit_pass(ps):
260 state = pass_visit_dict.get(ps, State.NotVisited)
261 if state == State.Visited:
262 return True
263 elif state == State.BeingVisited:
264 return False # this is a loop, need to remove this link
265 elif state == State.NotVisited:
266 pass_visit_dict[ps] = State.BeingVisited
267
268 ps.dag_predecessors = []
269 for pred in ps.predecessors:
270 if visit_pass(pred):
271 ps.dag_predecessors.append(pred)
272
273 pass_visit_dict[ps] = State.Visited
274 return True
275
276 for ps in self.passes:
277 if not ps.successors:
278 visit_pass(ps)
279
280 def build_cascaded_pass_links(self):
281 for cps in self.cascaded_passes:
282 cps.predecessors = []
283 cps.successors = []
284
285 for cps in self.cascaded_passes:
286 for tens in cps.inputs:
287 for op in tens.ops:
288 pred_cpass = op.scheduled_pass.cascade
289 if cps not in pred_cpass.successors:
290 pred_cpass.successors.append(cps)
291
292 if pred_cpass not in cps.predecessors:
293 cps.predecessors.append(pred_cpass)
294
295 assert tens in pred_cpass.outputs
296
297 def refresh_after_modification(self):
298 self.update_consumers()
299
300 def prune_startup_init_pass(self):
301 assert len(self.passes) >= 1
302 ps = self.passes[0]
303 assert ps.placement == PassPlacement.StartupInit
304
305 ps.outputs = [out_tens for out_tens in ps.outputs if len(out_tens.consumers()) > 0]
306 ps.ops = [op for op in ps.ops if op.outputs[0] in ps.outputs]
307
308 def get_all_ops(self):
309 all_ops = []
310 visit_op_set = set()
311 visit_tensor_set = set()
312
313 def visit_op(op):
314 if op in visit_op_set:
315 return
316 visit_op_set.add(op)
317 for inp in op.inputs:
318 visit_tensor(inp)
319
320 all_ops.append(op)
321
322 def visit_tensor(tens):
Andreas Nevalainene1cc3de2020-09-08 15:31:02 +0200323 if tens is None or tens in visit_tensor_set:
Tim Hall79d07d22020-04-27 18:20:16 +0100324 return
325 visit_tensor_set.add(tens)
326 for op in tens.ops:
327 visit_op(op)
328
329 for tens in self.output_tensors:
330 visit_tensor(tens)
331
332 return all_ops
333
334 def print_operators(self):
Michael McGeagh775e3962020-07-28 11:44:22 +0100335 print("print_operators()", self.name)
Tim Hall79d07d22020-04-27 18:20:16 +0100336 all_ops = self.get_all_ops()
337 unique_ops = []
Tim Hall79d07d22020-04-27 18:20:16 +0100338 for op in all_ops:
Michael McGeaghf3e3ad72020-12-02 12:39:03 +0000339 if op.type in (Op.Const, Op.Identity, Op.Placeholder):
Tim Hall79d07d22020-04-27 18:20:16 +0100340 continue
341
Louis Verhaardaee5d752020-09-30 09:01:52 +0200342 attrs = op.attrs.copy()
343 if op.type in (Op.Conv2D, Op.Conv2DBias, Op.DepthwiseConv2DBias):
Tim Hall79d07d22020-04-27 18:20:16 +0100344 kshape = op.inputs[1].shape
345 attrs["kshape"] = [kshape[0], kshape[1]]
Louis Verhaardaee5d752020-09-30 09:01:52 +0200346 attrs["type"] = op.type.name
Tim Hall79d07d22020-04-27 18:20:16 +0100347 attrs.pop("use_cudnn_on_gpu", None)
Fredrik Svedberg16343052021-04-16 14:36:22 +0200348 custom_options = attrs.pop("custom_options", None)
Tim Hall79d07d22020-04-27 18:20:16 +0100349 if attrs not in unique_ops:
350 unique_ops.append(attrs)
351 # print attributes in human readable format
352 a = attrs.copy()
Fredrik Svedberg16343052021-04-16 14:36:22 +0200353 if custom_options is not None:
354 a["custom_options"] = custom_options
Tim Hall79d07d22020-04-27 18:20:16 +0100355 s = a.pop("type")
356 data_format = a.pop("data_format", None)
357 if data_format and data_format != b"NHWC":
358 s += " " + str(data_format)
359 t = a.pop("T", None)
360 if t:
361 s += " " + str(t)[9:-2]
362 srct = a.pop("SrcT", None)
363 if srct:
364 s += " " + str(srct)[9:-2]
365 dstt = a.pop("DstT", None)
366 if dstt:
367 s += "->" + str(dstt)[9:-2]
368 print(s + " " + str(a))
369
Fredrik Svedbergc875aa62021-05-06 09:53:31 +0200370 def print_graph(self, label=None):
371 if label:
372 print(f"\n[ {label} ]")
Michael McGeagh775e3962020-07-28 11:44:22 +0100373 print("print_graph()", self.name)
Tim Hall79d07d22020-04-27 18:20:16 +0100374 all_ops = self.get_all_ops()
375 for idx, op in enumerate(all_ops):
376 print(idx, op.type, op.name)
377
378 def print_graph_with_tensors(self):
Michael McGeagh775e3962020-07-28 11:44:22 +0100379 print("print_graph_with_tensors()", self.name)
Tim Hall79d07d22020-04-27 18:20:16 +0100380 all_ops = self.get_all_ops()
381 for idx, op in enumerate(all_ops):
382 print(idx, op.type, op.name)
383 for idx, tens in enumerate(op.inputs):
Fredrik Svedbergb3d941e2021-10-13 14:06:03 +0200384 if tens:
385 print(
386 f" Input {idx:02d}"
387 f" {tens.purpose.name:>20} {tens.mem_area.name:>20} {tens.mem_type.name:>20} {tens}"
388 )
389 else:
390 print(f" Input {idx:02d} {'-':>20} {'-':>20} {'-':>20} {tens}")
Tim Hall79d07d22020-04-27 18:20:16 +0100391 for idx, tens in enumerate(op.outputs):
Patrik Gustavssoneca2e952020-05-27 09:15:11 +0200392 print(
Fredrik Svedbergb3d941e2021-10-13 14:06:03 +0200393 f" Output {idx:02d}"
394 f" {tens.purpose.name:>20} {tens.mem_area.name:>20} {tens.mem_type.name:>20} {tens}"
Patrik Gustavssoneca2e952020-05-27 09:15:11 +0200395 )
Tim Hall79d07d22020-04-27 18:20:16 +0100396 print()
397
398 def print_graph_with_tensor_quantization(self):
Michael McGeagh775e3962020-07-28 11:44:22 +0100399 print("print_graph_with_tensor_quantization()", self.name)
Tim Hall79d07d22020-04-27 18:20:16 +0100400 all_ops = self.get_all_ops()
401 for idx, op in enumerate(all_ops):
402 print(idx, op.type, op.name)
403 for idx, tens in enumerate(op.inputs):
Fredrik Svedbergb3d941e2021-10-13 14:06:03 +0200404 if tens:
405 q = tens.quantization
406 if q is None:
407 print(f" Input {idx:02d} {tens.dtype!s:>10} NO QUANTIZATION INFO {tens.name}")
408 else:
409 print(
410 f" Input {idx:02d} {tens.dtype!s:>10}"
411 f" min={q.min} max={q.max} scale={q.scale_f32!s} zero_point={q.zero_point} {tens.name}"
412 )
Tim Hall79d07d22020-04-27 18:20:16 +0100413 else:
Fredrik Svedbergb3d941e2021-10-13 14:06:03 +0200414 print(f" Input {idx:02d} {'-':>10} {tens}")
Tim Hall79d07d22020-04-27 18:20:16 +0100415 for idx, tens in enumerate(op.outputs):
416 q = tens.quantization
417 if q is None:
Fredrik Svedbergb3d941e2021-10-13 14:06:03 +0200418 print(f" Output {idx:02d} {tens.dtype!s:>10} NO QUANTIZATION INFO {tens.name}")
Tim Hall79d07d22020-04-27 18:20:16 +0100419 else:
420 print(
Fredrik Svedbergb3d941e2021-10-13 14:06:03 +0200421 f" Output {idx:02d} {tens.dtype!s:>10}"
422 f" min={q.min} max={q.max} scale={q.scale_f32!s} zero_point={q.zero_point} {tens.name}"
Tim Hall79d07d22020-04-27 18:20:16 +0100423 )
424 print()
425
426 def print_passes(self):
Michael McGeagh775e3962020-07-28 11:44:22 +0100427 print("print_passes()", self.name)
Tim Hall79d07d22020-04-27 18:20:16 +0100428 for idx, ps in enumerate(self.passes):
429 print("%03d %s" % (idx * 2, ps))
430
431 def print_passes_with_tensors(self):
Michael McGeagh775e3962020-07-28 11:44:22 +0100432 print("print_passes_with_tensors()", self.name)
Tim Hall79d07d22020-04-27 18:20:16 +0100433 for idx, ps in enumerate(self.passes):
434 print("%3d %s" % (idx * 2, ps))
435 for idx, tens in enumerate(ps.inputs):
436 print(
437 " Input %2d %-15s %-15s %-15s %s"
438 % (idx, tens.purpose.name, tens.mem_area.name, tens.format.name, tens.name)
439 )
440 for idx, tens in enumerate(ps.intermediates):
441 print(
442 " Intermediate %2d %-15s %-15s %-15s %s"
443 % (idx, tens.purpose.name, tens.mem_area.name, tens.format.name, tens.name)
444 )
445 for idx, tens in enumerate(ps.outputs):
446 print(
447 " Output %2d %-15s %-15s %-15s %s"
448 % (idx, tens.purpose.name, tens.mem_area.name, tens.format.name, tens.name)
449 )
450 print()
451
452 def print_cascaded_passes(self):
Michael McGeagh775e3962020-07-28 11:44:22 +0100453 print("print_cascaded_passes()", self.name)
Tim Hall79d07d22020-04-27 18:20:16 +0100454 for idx, ps in enumerate(self.cascaded_passes):
455 print("%3d %s SRAM used %.1f KB" % (idx * 2, ps, ps.sram_used / 1024))
456
457 def print_cascaded_passes_with_tensors(self):
Michael McGeagh775e3962020-07-28 11:44:22 +0100458 print("print_cascaded_passes_with_tensors()", self.name)
Tim Hall79d07d22020-04-27 18:20:16 +0100459 for idx, ps in enumerate(self.cascaded_passes):
460 print("%3d %s SRAM used %.1f KB" % (idx * 2, ps, ps.sram_used / 1024))
461 for idx, tens in enumerate(ps.inputs):
462 print(
463 " Input %2d %-15s %-15s %-15s %s"
464 % (idx, tens.purpose.name, tens.mem_area.name, tens.format.name, tens.name)
465 )
466 for idx, tens in enumerate(ps.intermediates):
467 print(
468 " Intermediate %2d %-15s %-15s %-15s %s"
469 % (idx, tens.purpose.name, tens.mem_area.name, tens.format.name, tens.name)
470 )
471 for idx, tens in enumerate(ps.outputs):
472 print(
473 " Output %2d %-15s %-15s %-15s %s"
474 % (idx, tens.purpose.name, tens.mem_area.name, tens.format.name, tens.name)
475 )
476 print()
477
478 def print_cascaded_passes_with_tensor_sizes(self):
Michael McGeagh775e3962020-07-28 11:44:22 +0100479 print("print_cascaded_passes_with_tensor_sizes()", self.name)
Tim Hall79d07d22020-04-27 18:20:16 +0100480 for idx, ps in enumerate(self.cascaded_passes):
481 print("%3d %s SRAM used %.1f KB" % (idx * 2, ps, ps.sram_used / 1024))
482 for idx, tens in enumerate(ps.inputs):
483 print(
484 " Input %2d %7.1f KB %-24s %-15s %-15s %-20s %s"
485 % (
486 idx,
487 tens.storage_size() / 1024,
488 tens.storage_shape,
489 tens.mem_area.name,
490 tens.purpose.name,
491 tens.format.name,
492 tens.name,
493 )
494 )
495 for idx, tens in enumerate(ps.intermediates):
496 print(
497 " Intermediate %2d %7.1f KB %-24s %-15s %-15s %-20s %s"
498 % (
499 idx,
500 tens.storage_size() / 1024,
501 tens.storage_shape,
502 tens.mem_area.name,
503 tens.purpose.name,
504 tens.format.name,
505 tens.name,
506 )
507 )
508 for idx, tens in enumerate(ps.outputs):
509 print(
510 " Output %2d %7.1f KB %-24s %-15s %-15s %-20s %s"
511 % (
512 idx,
513 tens.storage_size() / 1024,
514 tens.storage_shape,
515 tens.mem_area.name,
516 tens.purpose.name,
517 tens.format.name,
518 tens.name,
519 )
520 )
521 print()
522
523 def print_high_level_command_stream(self):
Michael McGeagh775e3962020-07-28 11:44:22 +0100524 print("print_high_level_command_stream()", self.name)
Tim Hall79d07d22020-04-27 18:20:16 +0100525 for idx, cmd in enumerate(self.high_level_command_stream):
526 print("%3d %s" % (idx, cmd))
527
528
529class Graph:
530 def __init__(self, name="<unnamed>", batch_size=1):
531 self.name = name
532 self.batch_size = batch_size
533 self.subgraphs = []
Michael McGeagh22f74e12020-08-07 16:21:03 +0100534 self.metadata = []
Tim Hall79d07d22020-04-27 18:20:16 +0100535 self.memory_used = {}
Diqing Zhongdb5124c2021-01-11 12:52:48 +0100536 self.total_original_weights = 0
Fredrik Svedbergf5c07c42021-04-23 14:36:42 +0200537 self.total_npu_weights = 0
538 self.total_npu_encoded_weights = 0
Louis Verhaard3c07c972020-05-07 08:12:58 +0200539 self.weight_cache = None # See CompressedWeightCache
Tim Hall79d07d22020-04-27 18:20:16 +0100540
541 def get_root_subgraph(self):
542 return self.subgraphs[0]
543
544 def prune_startup_init_pass(self):
545 for sg in self.subgraphs:
546 sg.prune_startup_init_pass()
547
548 def update_consumers(self):
549 for sg in self.subgraphs:
550 sg.update_consumers()
551
552 def refresh_after_modification(self):
553 for sg in self.subgraphs:
554 sg.refresh_after_modification()
555
556 def print_operators(self):
557 for sg in self.subgraphs:
558 sg.print_operators()
559
Fredrik Svedbergc875aa62021-05-06 09:53:31 +0200560 def print_graph(self, label=None):
Tim Hall79d07d22020-04-27 18:20:16 +0100561 for sg in self.subgraphs:
Fredrik Svedbergc875aa62021-05-06 09:53:31 +0200562 sg.print_graph(label)
Tim Hall79d07d22020-04-27 18:20:16 +0100563
564 def print_graph_with_tensors(self):
565 for sg in self.subgraphs:
566 sg.print_graph_with_tensors()
567
568 def print_graph_with_tensor_quantization(self):
569 for sg in self.subgraphs:
570 sg.print_graph_with_tensor_quantization()
571
572 def print_passes(self):
573 for sg in self.subgraphs:
574 sg.print_passes()
575
576 def print_passes_with_tensors(self):
577 for sg in self.subgraphs:
578 sg.print_passes_with_tensors()
579
580 def print_cascaded_passes(self):
581 for sg in self.subgraphs:
582 sg.print_cascaded_passes()
583
584 def print_cascaded_passes_with_tensors(self):
585 for sg in self.subgraphs:
586 sg.print_cascaded_passes_with_tensors()
587
588 def print_cascaded_passes_with_tensor_sizes(self):
589 for sg in self.subgraphs:
590 sg.print_cascaded_passes_with_tensor_sizes()
591
592 def print_high_level_command_stream(self):
593 for sg in self.subgraphs:
594 sg.print_high_level_command_stream()