MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / __repr__

Method __repr__

python/oneflow/nn/graph/proxy.py:529–561  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

527 return _s_block
528
529 def __repr__(self):
530 lines = None
531 child_lines = []
532 if len(self.to(GraphModule)._args_repr) > 0:
533 for in_str in self.to(GraphModule)._args_repr:
534 input_str = add_indent(in_str, 2)
535 child_lines.append(input_str)
536
537 def _append_child(d):
538 for (_, n) in d.items():
539 n_str = repr(n)
540 n_str = add_indent(n_str, 2)
541 child_lines.append(n_str)
542
543 _append_child(self._parameters)
544 _append_child(self._buffers)
545 _append_child(self._modules)
546
547 if len(self.to(GraphModule)._outs_repr) > 0:
548 for out_str in self.to(GraphModule)._outs_repr:
549 output_str = add_indent(out_str, 2)
550 child_lines.append(output_str)
551
552 child_lines.append(add_indent(repr(self.to(GraphModule)), 2))
553
554 if len(child_lines) > 0:
555 lines = child_lines
556
557 main_str = self._shallow_repr() + ": ("
558 if lines is not None:
559 main_str += "\n " + "\n ".join(lines) + "\n"
560 main_str += ")"
561 return main_str
562
563 def _shallow_repr(self):
564 shallow_repr = (

Callers

nothing calls this directly

Calls 5

_shallow_reprMethod · 0.95
add_indentFunction · 0.90
joinMethod · 0.80
toMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected