From 7fc264a9e669dda4df51dfdb52bbe347deb1c9f8 Mon Sep 17 00:00:00 2001 From: xie-oritek <142767785+xie-oritek@users.noreply.github.com> Date: Fri, 25 Aug 2023 00:47:24 +0800 Subject: [PATCH] Refine Tensor::SetShape api to avoid compile warning using const ref (#640) * Move int4/uint4 to the end of DataType * Refine api Tensor::SetShape, using const ref avoid compile warning --- include/tim/experimental/trace/README.md | 2 +- include/tim/vx/tensor.h | 2 +- include/tim/vx/types.h | 6 +++--- src/tim/vx/tensor.cc | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/tim/experimental/trace/README.md b/include/tim/experimental/trace/README.md index dd25bbe..8830e31 100755 --- a/include/tim/experimental/trace/README.md +++ b/include/tim/experimental/trace/README.md @@ -35,7 +35,7 @@ struct TensorSpec { TensorSpec& SetDataType(DataType datatype); - TensorSpec& SetShape(ShapeType& shape); + TensorSpec& SetShape(const ShapeType& shape); TensorSpec& SetAttribute(TensorAttribute attr); ... diff --git a/include/tim/vx/tensor.h b/include/tim/vx/tensor.h index 4e4b236..0d26d7a 100644 --- a/include/tim/vx/tensor.h +++ b/include/tim/vx/tensor.h @@ -106,7 +106,7 @@ struct TensorSpec { TensorSpec& SetDataType(DataType datatype); - TensorSpec& SetShape(ShapeType& shape); + TensorSpec& SetShape(const ShapeType& shape); TensorSpec& SetAttribute(TensorAttribute attr); diff --git a/include/tim/vx/types.h b/include/tim/vx/types.h index 432ff1c..7418fd4 100644 --- a/include/tim/vx/types.h +++ b/include/tim/vx/types.h @@ -29,8 +29,6 @@ namespace vx { enum class DataType { UNKNOWN, - INT4, - UINT4, INT8, UINT8, INT16, @@ -40,7 +38,9 @@ enum class DataType { INT64, FLOAT16, FLOAT32, - BOOL8 + BOOL8, + INT4, + UINT4 }; enum class QuantType { NONE, ASYMMETRIC, SYMMETRIC_PER_CHANNEL, DYNAMIC_FIXED_POINT }; diff --git a/src/tim/vx/tensor.cc b/src/tim/vx/tensor.cc index 3fcd246..e424843 100644 --- a/src/tim/vx/tensor.cc +++ b/src/tim/vx/tensor.cc @@ -401,7 +401,7 @@ TensorSpec& TensorSpec::SetDataType(DataType datatype) { return *this; } -TensorSpec& TensorSpec::SetShape(ShapeType& shape) { +TensorSpec& TensorSpec::SetShape(const ShapeType& shape) { this->shape_ = shape; return *this; }