Skip to content

Commit cd62a69

Browse files
committed
Replace prints with logging
1 parent d865898 commit cd62a69

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

Deeploy/DeeployTypes.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,19 +1101,16 @@ def check(self, node: gs.Node) -> bool:
11011101
valid = True
11021102

11031103
if not self.inputDescriptor.checkTensors(node.inputs):
1104-
# TODO: Change to logging
1105-
print(f"[ERROR OP {node.op}] Invalid input tensors: {[t.name for t in node.inputs]}")
1104+
log.error(f"[OP {node.op}] Invalid input tensors: {[t.name for t in node.inputs]}")
11061105
valid = False
11071106

11081107
if not self.outputDescriptor.checkTensors(node.outputs):
1109-
# TODO: Change to logging
1110-
print(f"[ERROR OP {node.op}] Invalid output tensors: {[t.name for t in node.outputs]}")
1108+
log.error(f"[OP {node.op}] Invalid output tensors: {[t.name for t in node.outputs]}")
11111109
valid = False
11121110

11131111
for attrDesc in self.attrDescriptors:
11141112
if attrDesc.default is None and not attrDesc.name in node.attrs:
1115-
# TODO: Change to logging
1116-
print(f"[ERROR OP {node.op}] Missing attribute {attrDesc.name}")
1113+
log.error(f"[OP {node.op}] Missing attribute {attrDesc.name}")
11171114
valid = False
11181115

11191116
return valid
@@ -1128,7 +1125,7 @@ def canonicalize(self, node: gs.Node, opset: int) -> bool:
11281125
try:
11291126
node.attrs[desc.name] = desc.unpack(value)
11301127
except Exception as e:
1131-
raise ValueError(f"[ERROR OP {node.op}] Error unpacking the attribute {desc.name}. {e}") from e
1128+
raise ValueError(f"[OP {node.op}] Error unpacking the attribute {desc.name}. {e}") from e
11321129
return True
11331130

11341131
def parseTensors(self, ctxt: NetworkContext, tensors: Sequence[gs.Tensor],
@@ -1158,7 +1155,7 @@ def parse(self, ctxt: NetworkContext, node: gs.Node) -> OperatorRepresentation:
11581155
firstKeySet = set(firstOpRepr.keys())
11591156
secondKeySet = set(secondOpRepr.keys())
11601157
assert firstKeySet.isdisjoint(secondKeySet), \
1161-
f"[PARSE ERROR] (Node: {node.name}, Op: {node.op}) " \
1158+
f"[OP {node.op}] Encourntered error while parsing node {node.name}. " \
11621159
f"Keys from parsing {firstName} clash with the keys from parsing {secondName}. "\
11631160
f"Overlapping keys: {firstKeySet ^ secondKeySet}"
11641161

Deeploy/OperatorDescriptor.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,7 @@ class RequantizedOperatorDescriptor(OperatorDescriptor):
396396

397397
def canonicalize(self, node: gs.Node, opset: int) -> bool:
398398
if "n_levels_out" in node.attrs and "n_levels" in node.attrs:
399-
# TODO: Change to log
400-
print("[WARNING] Requantized operator cannot have n_levels_out and n_levels in its attributes")
399+
log.warning("Requantized operator cannot have n_levels_out and n_levels in its attributes")
401400
return False
402401

403402
if "n_levels_out" in node.attrs:
@@ -711,10 +710,8 @@ def canonicalize(self, node: gs.Node, opset: int) -> bool:
711710
n_levels = f"{tensor}_n_levels"
712711
n_levels_out = f"{tensor}_n_levels_out"
713712
if n_levels_out in node.attrs and n_levels in node.attrs:
714-
# TODO: Change to log
715-
print(
716-
f"[WARNING] RequantizedAdd tensor {tensor} cannot have {n_levels_out} and {n_levels} in its attributes"
717-
)
713+
log.warning(
714+
f"RequantizedAdd tensor {tensor} cannot have {n_levels_out} and {n_levels} in its attributes")
718715
return False
719716

720717
if n_levels_out in node.attrs:

0 commit comments

Comments
 (0)