fix build warning

This commit is contained in:
sunsuodong 2022-02-14 22:38:05 -08:00
parent 564f6089c6
commit d3a67a0233
11 changed files with 19 additions and 37 deletions

View File

@ -97,7 +97,7 @@ class MS_API DelegateModel {
/// \brief Get the ms model version.
///
/// \return The schema version for the primitives map.
const SchemaVersion GetVersion() { return version_; }
SchemaVersion GetVersion() const { return version_; }
protected:
std::vector<kernel::Kernel *> *kernels_;

View File

@ -17,7 +17,7 @@
#include <stdlib.h>
#include <string.h>
#include "nnacl/infer/infer_register.h"
#include "plugin/device/cpu/kernel/nnacl/op_base.h"
#include "nnacl/op_base.h"
#ifndef CONTROLFLOW_TENSORLIST_CLIP
int MallocTensorListData(TensorListC *tensor_list, TypeIdC dtype, const vvector *tensor_shape) {

View File

@ -66,7 +66,7 @@ class MessageBase {
inline void SetTo(const AID &aTo) { to = aTo; }
inline const Type GetType() const { return type; }
inline Type GetType() const { return type; }
inline void SetType(Type eType) { type = eType; }

View File

@ -619,7 +619,7 @@ if(MSLITE_ENABLE_TOOLS)
endif()
endif()
if(NOT WIN32 AND MSLITE_ENABLE_TESTCASES AND NOT MSLITE_MINDDATA_IMPLEMENT STREQUAL "off")
if(NOT WIN32 AND MSLITE_ENABLE_TESTCASES)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
endif()

View File

@ -75,7 +75,7 @@ struct Context {
Vector<int> affinity_core_list_; /**< explicitly specify the core to be bound. priority use affinity core list */
AllocatorPtr allocator = nullptr;
#ifndef NOT_USE_STL
DeviceContextVector device_list_ = {{DT_CPU, {false, MID_CPU}}};
DeviceContextVector device_list_ = {{DT_CPU, {{false, MID_CPU}}}};
#else
DeviceContextVector device_list_;
#endif // NOT_USE_STL

View File

@ -41,8 +41,6 @@ class ModelC {
MSTensor::Impl **GetInputs(size_t *input_num);
MSTensor::Impl **GetOutputs(size_t *output_num);
MSTensor::Impl *GetInputByTensorName(const std::string &name);
MSTensor::Impl *GetOutputByTensorName(const std::string &name);
private:
std::shared_ptr<lite::LiteSession> session_ = nullptr;
@ -284,24 +282,6 @@ MSTensor::Impl **ModelC::GetOutputs(size_t *output_num) {
});
return outputs_.data();
}
MSTensor::Impl *ModelC::GetInputByTensorName(const std::string &name) {
if (session_ == nullptr) {
MS_LOG(ERROR) << "Session is null.";
return nullptr;
}
auto tensor = session_->GetInputsByTensorName(name);
return TensorToTensorImpl(tensor);
}
MSTensor::Impl *ModelC::GetOutputByTensorName(const std::string &name) {
if (session_ == nullptr) {
MS_LOG(ERROR) << "Session is null.";
return nullptr;
}
auto tensor = session_->GetOutputByTensorName(name);
return TensorToTensorImpl(tensor);
}
} // namespace mindspore
MSModelHandle MSModelCreate() {

View File

@ -36,7 +36,7 @@ namespace mindspore::lite {
class ControlFlowScheduler {
public:
ControlFlowScheduler(InnerContext *ctx, const mindspore::Context *ms_ctx, std::vector<Tensor *> *src_tensors)
: context_(ctx), ms_context_(ms_ctx), src_tensors_(src_tensors) {}
: context_(ctx), src_tensors_(src_tensors) {}
~ControlFlowScheduler() = default;
int Schedule(std::vector<kernel::LiteKernel *> *dst_kernels);
void SetSubgraphForPartialNode(std::unordered_map<kernel::LiteKernel *, size_t> *partial_kernel_subgraph_index_map,
@ -91,7 +91,6 @@ class ControlFlowScheduler {
private:
InnerContext *context_ = nullptr;
const mindspore::Context *ms_context_ = nullptr;
int schema_version_ = SCHEMA_VERSION::SCHEMA_CUR;
std::vector<Tensor *> *src_tensors_ = nullptr;
std::queue<kernel::LiteKernel *> to_process_q_{};

View File

@ -139,7 +139,7 @@ lite::InnerContext *ContextUtils::Convert(const ContextC *context_c) {
Status ret = kLiteError;
for (auto &device_info_c : device_list) {
MS_CHECK_TRUE_RET(device_info_c != nullptr, nullptr);
lite::DeviceInfo device_info = {0};
lite::DeviceInfo device_info = {{0}};
if (device_info_c->device_type == kMSDeviceTypeCPU) {
if (device_info_c->allocator == nullptr) {
device_info_c->allocator = Allocator::Create();

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "src/ops/populate/populate_register.h"
#include "plugin/device/cpu/kernel/nnacl/op_base.h"
#include "nnacl/op_base.h"
using mindspore::schema::PrimitiveType_Adam;
namespace mindspore {

View File

@ -83,13 +83,13 @@ class NMSBox {
return score_ < box.score_ || (std::abs(score_ - box.score_) < FLT_EPSILON && index_ > box.index_);
}
const float get_score() const { return score_; }
const int get_index() const { return index_; }
const float get_y1() const { return y1_; }
const float get_y2() const { return y2_; }
const float get_x1() const { return x1_; }
const float get_x2() const { return x2_; }
const float get_area() const { return area_; }
float get_score() const { return score_; }
int get_index() const { return index_; }
float get_y1() const { return y1_; }
float get_y2() const { return y2_; }
float get_x1() const { return x1_; }
float get_x2() const { return x2_; }
float get_area() const { return area_; }
private:
float score_;

View File

@ -145,7 +145,10 @@ target_compile_options(gmock_tests PRIVATE -fno-rtti)
target_link_libraries(lite-test gmock_tests)
if(MSLITE_ENABLE_TRAIN)
target_link_libraries(lite-test mindspore-lite-train minddata-lite)
target_link_libraries(lite-test mindspore-lite-train)
if(NOT MSLITE_MINDDATA_IMPLEMENT STREQUAL "off")
target_link_libraries(lite-test minddata-lite)
endif()
endif()
if(PLATFORM_ARM)