From cd8760643c65b19782c5759c7ab3659695b981d2 Mon Sep 17 00:00:00 2001 From: Sergey Mironov Date: Tue, 3 Sep 2019 16:29:08 +0300 Subject: [PATCH] Check types of name input parameters --- tensorflow/lite/python/util.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tensorflow/lite/python/util.py b/tensorflow/lite/python/util.py index 775881ad9f7..50b5a45b99c 100644 --- a/tensorflow/lite/python/util.py +++ b/tensorflow/lite/python/util.py @@ -110,6 +110,12 @@ def get_tensors_from_tensor_names(graph, tensor_names): tensors = [] invalid_tensors = [] for name in tensor_names: + if not isinstance(name, str): + raise ValueError("Invalid type for a tensor name in the provided graph. " + "Expected type for a tensor name is 'str', instead got " + "type '{}' for tensor name '{}'".format( + type(name), name)) + tensor = tensor_name_to_tensor.get(name) if tensor is None: invalid_tensors.append(name)