Skip to content

Commit

Permalink
Merge pull request #125 from uTensor/fix-tensor-name
Browse files Browse the repository at this point in the history
Fix tensor name
  • Loading branch information
mbartling authored Oct 28, 2020
2 parents 671f2c6 + 6b94245 commit a54fa40
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions utensor_cgen/frontend/tflite.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ def _build_tensor_map(self, fb_model, ugraph):
for idx in range(0, subgraph.TensorsLength()):
tensor = subgraph.Tensors(idx)
tensor_name = tensor.Name().decode('utf8')
illegal_chars = ';'
if any(c in tensor_name for c in illegal_chars):
logger.warning(
f'Unexpected character founded in tensor name {tensor_name}, will be replaced or pruned'
)
tensor_name = tensor_name.replace(';', '__')
if tensor_name is "" or None:
tensor_name = "tensor_" + str(idx)

Expand Down

0 comments on commit a54fa40

Please sign in to comment.