From 8e63e8c8f32f4e48c6fa6552a750b1d46f86747d Mon Sep 17 00:00:00 2001 From: lilei Date: Mon, 27 Sep 2021 16:09:15 +0800 Subject: [PATCH] refine tensor to support attribute access --- include/tim/vx/tensor.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/tim/vx/tensor.h b/include/tim/vx/tensor.h index b334840..d9f8812 100644 --- a/include/tim/vx/tensor.h +++ b/include/tim/vx/tensor.h @@ -48,25 +48,29 @@ class Quantization { scales_(std::move(scales)), zero_points_(std::move(zero_points)) {} - QuantType Type() { return type_; } + QuantType& Type() { return type_; } + const QuantType& Type() const { return type_; } Quantization& SetType(QuantType type) { this->type_ = type; return *this; } - int32_t ChannelDim() { return this->channel_dim_; } + int32_t& ChannelDim() { return this->channel_dim_; } + const int32_t& ChannelDim() const { return this->channel_dim_; } Quantization& SetChannelDim(int32_t channel_dim) { this->channel_dim_ = channel_dim; return *this; } std::vector& Scales() { return this->scales_; } + const std::vector& Scales() const { return this->scales_; } Quantization& SetScales(std::vector scales) { this->scales_ = scales; return *this; } std::vector& ZeroPoints() { return this->zero_points_; } + const std::vector& ZeroPoints() const { return this->zero_points_; } Quantization& SetZeroPoints(std::vector zero_points) { this->zero_points_ = zero_points; return *this;