From b53a461cf1c41b01a523fb5960451f1f992fecdc Mon Sep 17 00:00:00 2001 From: Bin Li Date: Tue, 12 May 2020 14:34:00 +0800 Subject: [PATCH] Fix onnx depthspace and cmake host --- mace/core/net_def_adapter.cc | 3 ++- third_party/third_party.cmake | 5 ++++- tools/python/transform/onnx_converter.py | 11 +++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/mace/core/net_def_adapter.cc b/mace/core/net_def_adapter.cc index 7aa084b3..8b2fc402 100644 --- a/mace/core/net_def_adapter.cc +++ b/mace/core/net_def_adapter.cc @@ -347,7 +347,8 @@ MaceStatus NetDefAdapter::AdaptDevice(OpConditionContext *context, if (device_type == target_device_type) { context->set_device(target_device); } else { - LOG(INFO) << "Op " << op_def->name() << " fall back to CPU"; + LOG(INFO) << "Op " << op_def->name() << "(" << op_def->type() << ")" + << " fall back to CPU"; } } op_def->set_device_type(device_type); diff --git a/third_party/third_party.cmake b/third_party/third_party.cmake index 02cd3c18..fd66d906 100644 --- a/third_party/third_party.cmake +++ b/third_party/third_party.cmake @@ -51,7 +51,10 @@ include(${PROJECT_SOURCE_DIR}/third_party/opencl-headers/opencl-headers.cmake) include(${PROJECT_SOURCE_DIR}/third_party/protobuf/protobuf.cmake) include(${PROJECT_SOURCE_DIR}/third_party/tflite/tflite.cmake) include(${PROJECT_SOURCE_DIR}/third_party/caffe/caffe.cmake) -include(${PROJECT_SOURCE_DIR}/third_party/rpcmem/rpcmem.cmake) + +if(MACE_ENABLE_RPCMEM) + include(${PROJECT_SOURCE_DIR}/third_party/rpcmem/rpcmem.cmake) +endif(MACE_ENABLE_RPCMEM) if(MACE_ENABLE_HEXAGON_DSP) include(${PROJECT_SOURCE_DIR}/third_party/nnlib/nnlib.cmake) diff --git a/tools/python/transform/onnx_converter.py b/tools/python/transform/onnx_converter.py index 62b380c3..4c745442 100644 --- a/tools/python/transform/onnx_converter.py +++ b/tools/python/transform/onnx_converter.py @@ -806,17 +806,20 @@ class OnnxConverter(base_converter.ConverterInterface): def convert_depth_space(self, node): op = self.convert_general_op(node) - if op.type == OnnxOpType.DepthToSpace.name: + if node.op_type == OnnxOpType.DepthToSpace.name: op.type = MaceOp.DepthToSpace.name else: op.type = MaceOp.SpaceToDepth.name - mace_check(('block_size' in node.attrs), - "depth to space op should have block size attribute.") - block_size = node.attrs['block_size'] + mace_check(('blocksize' in node.attrs), + "DepthToSpace/SpaceToDepth must have blocksize attribute.") + block_size = node.attrs['blocksize'] size_arg = op.arg.add() size_arg.name = MaceKeyword.mace_space_depth_block_size_str size_arg.i = block_size + if 'mode' in node.attrs: + mace_check(node.attrs['mode'] == 'DCR', "Only supports DCR mode.") + def convert_dim_range(self, node): op = self.convert_general_op(node) op.type = MaceOp.Slice.name -- GitLab