forked from gmalivenko/onnx2keras
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ranhomri
committed
Nov 17, 2024
1 parent
3c4aef1
commit 3699592
Showing
4 changed files
with
51 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
def log_oom_layers(model, logger): | ||
# Load the ONNX model | ||
graph = model.graph | ||
|
||
# Log general model information | ||
logger.debug("IR_VERSION: {}".format(model.ir_version)) | ||
logger.debug("PRODUCER: {}".format(model.producer_name)) | ||
logger.debug("PRODUCER_VERSION: {}".format(model.producer_version)) | ||
logger.debug("DOMAIN: {}".format(model.domain)) | ||
logger.debug("MODEL_VERSION: {}".format(model.model_version)) | ||
logger.debug("OPSET_IMPORT: {}".format(str({opset.domain: opset.version for opset in model.opset_import}))) | ||
|
||
# Log input information | ||
for input_tensor in graph.input: | ||
logger.debug("Input: {}; Shape: {}; Type: {}".format( | ||
input_tensor.name, | ||
str(input_tensor.type.tensor_type.shape.dim).replace('\n', ''), | ||
input_tensor.type.tensor_type.elem_type | ||
)) | ||
|
||
# Log output information | ||
for output_tensor in graph.output: | ||
logger.debug("Output: {}; Shape: {}; Type: {}".format( | ||
output_tensor.name, | ||
str(output_tensor.type.tensor_type.shape.dim).replace('\n', ''), | ||
output_tensor.type.tensor_type.elem_type | ||
)) | ||
|
||
# Log initializers | ||
for initializer in graph.initializer: | ||
raw_data_log = initializer.raw_data if len(initializer.raw_data)<50 else "" | ||
logger.debug("Initializer: {}; Shape: {}; Type: {}; Raw Data: {}".format( | ||
initializer.name, | ||
initializer.dims, | ||
initializer.data_type, | ||
raw_data_log | ||
)) | ||
|
||
# Log each node's information | ||
for node in graph.node: | ||
logger.debug("Node: {}; Name: {}".format(node.op_type, node.name)) | ||
logger.debug(" Inputs: {}".format(node.input)) | ||
logger.debug(" Outputs: {}".format(node.output)) | ||
logger.debug(" Attributes:") | ||
for attr in node.attribute: | ||
logger.debug(" - {}: {}".format(attr.name, attr)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "onnx2kerastl" | ||
version = "0.0.152" | ||
version = "0.0.153" | ||
description = "" | ||
authors = ["dorhar <[email protected]>"] | ||
license = "MIT" | ||
|