MCPcopy Create free account
hub / github.com/OpenPPL/ppl.nn / PrintInputOutputInfo

Function PrintInputOutputInfo

tools/pplnn.py:563–593  ·  view source on GitHub ↗
(runtime)

Source from the content-addressed store, hash-verified

561 return ret
562
563def PrintInputOutputInfo(runtime):
564 print("----- input info -----")
565 for i in range(runtime.GetInputCount()):
566 tensor = runtime.GetInputTensor(i)
567 shape = tensor.GetShape()
568 dims = shape.GetDims()
569 print("input[" + str(i) + "]:")
570 print(" name: " + tensor.GetName())
571 print(" dim(s):" + Dims2Str(dims))
572 print(" data type: " + pplcommon.GetDataTypeStr(shape.GetDataType()))
573 print(" data format: " + pplcommon.GetDataFormatStr(shape.GetDataFormat()))
574 print(" byte(s) excluding padding: " + str(CalcBytes(dims, pplcommon.GetSizeOfDataType(shape.GetDataType()))))
575
576 print("----- output info -----")
577 for i in range(runtime.GetOutputCount()):
578 tensor = runtime.GetOutputTensor(i)
579 shape = tensor.GetShape()
580 dims = shape.GetDims()
581 print("output[" + str(i) + "]:")
582 print(" name: " + tensor.GetName())
583 print(" dim(s):" + Dims2Str(dims))
584 print(" data type: " + pplcommon.GetDataTypeStr(shape.GetDataType()))
585 print(" data format: " + pplcommon.GetDataFormatStr(shape.GetDataFormat()))
586 print(" byte(s) excluding padding: " + str(CalcBytes(dims, pplcommon.GetSizeOfDataType(shape.GetDataType()))))
587
588 saved_data_type = shape.GetDataType()
589 if saved_data_type == pplcommon.DATATYPE_FLOAT16: # convert fp16 to fp32 when saving to file
590 saved_data_type = pplcommon.DATATYPE_FLOAT32
591 print(" saved data type: " + pplcommon.GetDataTypeStr(saved_data_type))
592
593 print("----------------------")
594
595# ---------------------------------------------------------------------------- #
596

Callers 1

pplnn.pyFile · 0.70

Calls 8

Dims2StrFunction · 0.85
CalcBytesFunction · 0.85
GetInputTensorMethod · 0.80
GetOutputTensorMethod · 0.80
GetInputCountMethod · 0.45
GetShapeMethod · 0.45
GetNameMethod · 0.45
GetOutputCountMethod · 0.45

Tested by

no test coverage detected