Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
fix(test): fix preprocessor building for image test
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhxiao committed Aug 2, 2019
1 parent 50fdc04 commit f6a801f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions gnes/composer/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions tests/test_image_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit f6a801f

Please sign in to comment.