From f6a801f7b18a5df435335778deaba790df09526c Mon Sep 17 00:00:00 2001 From: hanhxiao Date: Fri, 2 Aug 2019 12:17:07 +0800 Subject: [PATCH] fix(test): fix preprocessor building for image test --- gnes/composer/base.py | 6 +++--- tests/test_image_encoder.py | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/gnes/composer/base.py b/gnes/composer/base.py index 3534e75d..1fcac2ef 100644 --- a/gnes/composer/base.py +++ b/gnes/composer/base.py @@ -156,10 +156,10 @@ def build_layers(self) -> List['YamlComposer.Layer']: last_layer = self._layers[idx - 1] for l in self._add_router(last_layer, layer): all_layers.append(copy.deepcopy(l)) - # # add frontend - # for l in self._add_router(all_layers[-1], all_layers[0]): - # all_layers.append(copy.deepcopy(l)) all_layers[0] = copy.deepcopy(self._layers[0]) + + # gRPCfrontend should always on the bind role + return all_layers @staticmethod diff --git a/tests/test_image_encoder.py b/tests/test_image_encoder.py index 5582d039..82917678 100644 --- a/tests/test_image_encoder.py +++ b/tests/test_image_encoder.py @@ -4,7 +4,7 @@ import zipfile from gnes.encoder.image.base import BasePytorchEncoder -from gnes.preprocessor.base import BaseUnaryPreprocessor +from gnes.preprocessor.base import BaseUnaryPreprocessor, PipelinePreprocessor from gnes.preprocessor.image.resize import ResizeChunkPreprocessor from gnes.preprocessor.image.sliding_window import VanillaSlidingPreprocessor from gnes.proto import gnes_pb2, blob2array @@ -20,8 +20,10 @@ def img_process_for_test(dirname): test_img.append(d) test_img_all_preprocessor = [] - for preprocessor in [BaseUnaryPreprocessor(doc_type=gnes_pb2.Document.IMAGE), - ResizeChunkPreprocessor(), + pipline_prep1 = PipelinePreprocessor() + pipline_prep1.component = lambda: [BaseUnaryPreprocessor(doc_type=gnes_pb2.Document.IMAGE), + ResizeChunkPreprocessor()] + for preprocessor in [pipline_prep1, VanillaSlidingPreprocessor()]: test_img_copy = copy.deepcopy(test_img) for img in test_img_copy: