!6122 [MS][LITE][Develop]lite/internal support infershape
Merge pull request !6122 from chenjianping/lite_dev2pull/6122/MERGE
commit
a25fcf3ce3
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright 2020 Huawei Technologies Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "internal/src/kernel/common/common_infershape.h"
|
||||
#include "internal/include/errorcode.h"
|
||||
#include "internal/include/ms_tensor.h"
|
||||
#include "utils/log_adapter.h"
|
||||
|
||||
int DoCommonInferShape(const TensorPtrVector &in_tensors, const TensorPtrVector &out_tensors) {
|
||||
TensorPtr input = in_tensors.at(0);
|
||||
MS_ASSERT(input != nullptr);
|
||||
TensorPtr output = out_tensors.at(0);
|
||||
MS_ASSERT(output != nullptr);
|
||||
output->format_ = input->format_;
|
||||
output->data_type_ = input->data_type_;
|
||||
output->shape_ = input->shape_;
|
||||
return RET_OK;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright 2020 Huawei Technologies Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef MINDSPORE_LITE_INTERNAL_SRC_KERNEL_COMMON_INFERSHAPE_H_
|
||||
#define MINDSPORE_LITE_INTERNAL_SRC_KERNEL_COMMON_INFERSHAPE_H_
|
||||
|
||||
#include "internal/include/model.h"
|
||||
|
||||
int DoCommonInferShape(const TensorPtrVector &in_tensors, const TensorPtrVector &out_tensors);
|
||||
|
||||
#endif // MINDSPORE_LITE_INTERNAL_SRC_KERNEL_COMMON_INFERSHAPE_H_
|
@ -0,0 +1,73 @@
|
||||
set(TOP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../..)
|
||||
set(TEST_DIR ${TOP_DIR}/mindspore/lite/test)
|
||||
set(LITE_DIR ${TOP_DIR}/mindspore/lite)
|
||||
|
||||
include_directories(${TOP_DIR})
|
||||
include_directories(${TEST_DIR})
|
||||
|
||||
string(REPLACE " -Werror " " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
string(REPLACE " -Werror " " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
STRING(REPLACE " -fvisibility=hidden " " -fvisibility=default " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
STRING(REPLACE " -fvisibility=hidden " " -fvisibility=default " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
|
||||
### cpu kernel
|
||||
file(GLOB KERNEL_OP_SRC
|
||||
${LITE_DIR}/internal/src/kernel/*.cc
|
||||
${LITE_DIR}/internal/src/kernel/common/*.cc
|
||||
${LITE_DIR}/internal/src/kernel/fp32/*.cc
|
||||
${LITE_DIR}/internal/src/kernel/fp32_grad/*.cc
|
||||
${LITE_DIR}/nnacl/*.c
|
||||
${LITE_DIR}/nnacl/fp32/*.c
|
||||
${LITE_DIR}/nnacl/fp32_grad/*.c
|
||||
${LITE_DIR}/nnacl/int8/*.c
|
||||
${LITE_DIR}/nnacl/quantization/*.c
|
||||
)
|
||||
|
||||
if (PLATFORM_ARM64)
|
||||
# assembly
|
||||
file(GLOB TEST_ASSEMBLY_SRC ${LITE_DIR}/nnacl/assembly/arm64/*.s
|
||||
${LITE_DIR}/nnacl/assembly/arm64/*.S)
|
||||
|
||||
set_property(SOURCE ${TEST_ASSEMBLY_SRC} PROPERTY LANGUAGE C)
|
||||
set(KERNEL_OP_SRC
|
||||
${KERNEL_OP_SRC}
|
||||
${TEST_ASSEMBLY_SRC}
|
||||
)
|
||||
endif()
|
||||
|
||||
### runtime framework
|
||||
set(TEST_LITE_SRC
|
||||
${LITE_DIR}/internal/src/lite_session.cc
|
||||
${LITE_DIR}/src/runtime/allocator.cc
|
||||
${LITE_DIR}/internal/src/ms_tensor.cc
|
||||
${TOP_DIR}/mindspore/core/utils/log_adapter.cc
|
||||
${TOP_DIR}/mindspore/core/gvar/logging_level.cc
|
||||
)
|
||||
|
||||
### test src
|
||||
file(GLOB_RECURSE TEST_CASE_KERNEL_SRC
|
||||
${TEST_DIR}/ut/internal/*.cc
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE TEST_CASE_KERNEL_TRAIN_SRC
|
||||
${TEST_DIR}/ut/src/runtime/kernel/arm/fp32_grad/*.cc
|
||||
)
|
||||
|
||||
set(TEST_SRC
|
||||
${TEST_LITE_SRC}
|
||||
${TEST_CASE_KERNEL_SRC}
|
||||
${KERNEL_OP_SRC}
|
||||
${TEST_DIR}/common/common_test.cc
|
||||
${TEST_DIR}/main.cc
|
||||
)
|
||||
|
||||
add_executable(lite-test-internal ${TEST_SRC})
|
||||
|
||||
target_link_libraries(lite-test-internal dl ${GTEST_LIBRARY})
|
||||
if (PLATFORM_ARM64)
|
||||
target_link_libraries(lite-test-internal mslite_internal)
|
||||
endif()
|
||||
|
||||
if (PLATFORM_ARM32 OR PLATFORM_ARM64)
|
||||
target_link_libraries(lite-test-internal log)
|
||||
endif()
|
Loading…
Reference in new issue