From 9e9b6747d4aa80add5f06f98d81e7094ee2f7cb9 Mon Sep 17 00:00:00 2001 From: Vignesh Date: Mon, 18 Aug 2025 14:29:29 -0400 Subject: [PATCH 1/4] initial commit --- src/tensorflow_module.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/tensorflow_module.py b/src/tensorflow_module.py index 6e64035..3222b79 100755 --- a/src/tensorflow_module.py +++ b/src/tensorflow_module.py @@ -130,6 +130,7 @@ def reconfigure( info = (f._arg_keywords[i], prepShape(ff.get_shape()), ff.dtype) self.input_info.append(info) + LOGGER.info(f"reconfigured input_info: {self.input_info}") for out in f.outputs: info = (out.name, prepShape(out.get_shape()), out.dtype) self.output_info.append(info) @@ -149,6 +150,7 @@ def _prepare_inputs(self, input_tensors: Dict[str, NDArray]) -> NDArray: input_t = tf.convert_to_tensor(input_t, dtype=self.input_info[i][2]) input_list.append(input_t) + if len(input_vars) == 1: return np.squeeze(np.asarray(input_list), axis=0) return np.asarray(input_list) @@ -234,6 +236,7 @@ async def metadata( input_info = [] output_info = [] for inputT in self.input_info: + LOGGER.info(f"inputT: {inputT}") info = TensorInfo( name=inputT[0], shape=prepShape(inputT[1]), @@ -250,6 +253,8 @@ async def metadata( ) output_info.append(info) + LOGGER.info(f"metadata input_info: {input_info}") + LOGGER.info(f"metadata output_info: {output_info}") return Metadata( name="tensorflow_model", input_info=input_info, output_info=output_info ) @@ -279,7 +284,11 @@ def prepShape(tensorShape): # Want to return a simple string ("float32", "int64", etc.) def prepType(tensorType, is_keras): - if tensorType is None or not isinstance(tensorType, str): + if tensorType is None: + return "unknown" + if hasattr(tensorType, 'name'): + return tensorType.name + if not isinstance(tensorType, str): return "unknown" if is_keras: return tensorType From c2722d35790c1cf2cab055fd3fc0dc0edbfbde9c Mon Sep 17 00:00:00 2001 From: Vignesh Date: Mon, 18 Aug 2025 14:57:08 -0400 Subject: [PATCH 2/4] remove logs --- src/tensorflow_module.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/tensorflow_module.py b/src/tensorflow_module.py index 3222b79..8b4716e 100755 --- a/src/tensorflow_module.py +++ b/src/tensorflow_module.py @@ -130,7 +130,6 @@ def reconfigure( info = (f._arg_keywords[i], prepShape(ff.get_shape()), ff.dtype) self.input_info.append(info) - LOGGER.info(f"reconfigured input_info: {self.input_info}") for out in f.outputs: info = (out.name, prepShape(out.get_shape()), out.dtype) self.output_info.append(info) @@ -236,7 +235,6 @@ async def metadata( input_info = [] output_info = [] for inputT in self.input_info: - LOGGER.info(f"inputT: {inputT}") info = TensorInfo( name=inputT[0], shape=prepShape(inputT[1]), @@ -253,8 +251,6 @@ async def metadata( ) output_info.append(info) - LOGGER.info(f"metadata input_info: {input_info}") - LOGGER.info(f"metadata output_info: {output_info}") return Metadata( name="tensorflow_model", input_info=input_info, output_info=output_info ) From f42cdef2d13eb3fa43a75fa8595df46d63ff5efe Mon Sep 17 00:00:00 2001 From: Vignesh Date: Mon, 18 Aug 2025 14:58:01 -0400 Subject: [PATCH 3/4] add some ignores --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index af37b90..7a4b798 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ .setup +.venv +build/ +dist/ \ No newline at end of file From 04337b18b18e068f8d0ec669955e74d80fd7126d Mon Sep 17 00:00:00 2001 From: Vignesh Date: Mon, 18 Aug 2025 15:59:34 -0400 Subject: [PATCH 4/4] add test --- tests/mock_model.keras | Bin 0 -> 13458 bytes tests/test_tensorflow.py | 45 +++++++++++++++++++++++++++++++++------ 2 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 tests/mock_model.keras diff --git a/tests/mock_model.keras b/tests/mock_model.keras new file mode 100644 index 0000000000000000000000000000000000000000..a5c653bd4b9064be8446b5f5b160e99cdc962aaa GIT binary patch literal 13458 zcmeHO%}*pn6t7{xovdzTl>~R=$80CYRbj%1B*;NA0*hhePFCCy32B<4nQ3XdC*3_P zNKlTLc<{(!O+0!eo;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