From fd8fde80452ba68a21de4de53517ebc4b4aac9ea Mon Sep 17 00:00:00 2001 From: Tai Ly Date: Mon, 13 Nov 2023 20:18:14 +0000 Subject: [reference_model] Add local_bound support Add support for local_bound attributes. Signed-off-by: Tai Ly Change-Id: Ie1acb65ca2495fb7d1512bf120568c695635d631 --- reference_model/src/operators.cc | 13 +++++++++---- reference_model/src/ops/tensor_ops.cc | 7 ++++++- reference_model/src/ops/tensor_ops.h | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) (limited to 'reference_model/src') diff --git a/reference_model/src/operators.cc b/reference_model/src/operators.cc index 9c7f9ef..13e8b12 100644 --- a/reference_model/src/operators.cc +++ b/reference_model/src/operators.cc @@ -200,6 +200,7 @@ extern "C" const int32_t client_dilation[2], const int32_t client_input_zp, const int32_t client_weight_zp, + const bool client_local_bound, tosa_tensor_t client_output, const func_ctx_t& func_ctx) { @@ -207,7 +208,7 @@ extern "C" const std::vector pad(&client_pad[0], &client_pad[4]); const std::vector stride(&client_stride[0], &client_stride[2]); const std::vector dilation(&client_dilation[0], &client_dilation[2]); - TosaConvAttribute attr(pad, stride, dilation, client_input_zp, client_weight_zp); + TosaConvAttribute attr(pad, stride, dilation, client_input_zp, client_weight_zp, client_local_bound); // Create tensors tosa::TosaSerializationTensor* input = translate_client_tensor(client_input, "input"); @@ -249,6 +250,7 @@ extern "C" const int32_t client_dilation[3], const int32_t client_input_zp, const int32_t client_weight_zp, + const bool client_local_bound, tosa_tensor_t client_output, const func_ctx_t& func_ctx) { @@ -256,7 +258,7 @@ extern "C" const std::vector pad(&client_pad[0], &client_pad[6]); const std::vector stride(&client_stride[0], &client_stride[3]); const std::vector dilation(&client_dilation[0], &client_dilation[3]); - TosaConvAttribute attr(pad, stride, dilation, client_input_zp, client_weight_zp); + TosaConvAttribute attr(pad, stride, dilation, client_input_zp, client_weight_zp, client_local_bound); // Create tensors tosa::TosaSerializationTensor* input = translate_client_tensor(client_input, "input"); @@ -298,6 +300,7 @@ extern "C" const int32_t client_dilation[2], const int32_t client_input_zp, const int32_t client_weight_zp, + const bool client_local_bound, tosa_tensor_t client_output, const func_ctx_t& func_ctx) { @@ -305,7 +308,7 @@ extern "C" const std::vector pad(&client_pad[0], &client_pad[4]); const std::vector stride(&client_stride[0], &client_stride[2]); const std::vector dilation(&client_dilation[0], &client_dilation[2]); - TosaConvAttribute attr(pad, stride, dilation, client_input_zp, client_weight_zp); + TosaConvAttribute attr(pad, stride, dilation, client_input_zp, client_weight_zp, client_local_bound); // Create tensors tosa::TosaSerializationTensor* input = translate_client_tensor(client_input, "input"); @@ -470,6 +473,7 @@ extern "C" const int32_t client_out_shape[4], const int32_t client_input_zp, const int32_t client_weight_zp, + const bool client_local_bound, tosa_tensor_t client_output, const func_ctx_t& func_ctx) { @@ -477,7 +481,8 @@ extern "C" const std::vector out_pad(&client_out_pad[0], &client_out_pad[4]); const std::vector stride(&client_stride[0], &client_stride[2]); const std::vector out_shape(&client_out_shape[0], &client_out_shape[4]); - TosaTransposeConvAttribute attr(out_pad, stride, out_shape, client_input_zp, client_weight_zp); + TosaTransposeConvAttribute attr(out_pad, stride, out_shape, client_input_zp, client_weight_zp, + client_local_bound); // Create tensors tosa::TosaSerializationTensor* input = translate_client_tensor(client_input, "input"); diff --git a/reference_model/src/ops/tensor_ops.cc b/reference_model/src/ops/tensor_ops.cc index 2d54d8e..3f0e7b2 100644 --- a/reference_model/src/ops/tensor_ops.cc +++ b/reference_model/src/ops/tensor_ops.cc @@ -1736,11 +1736,16 @@ OpRFFT2d::OpRFFT2d(SubgraphTraverser* sgt_, TosaAttributeBase* attribute_ { setRequiredOperands(1, 2); setRequiredRank(3, 3); + + INIT_ATTRIBUTE(RFFT); } template OpRFFT2d::~OpRFFT2d() -{} +{ + if (attribute) + delete attribute; +} template int OpRFFT2d::checkTensorAttributes() diff --git a/reference_model/src/ops/tensor_ops.h b/reference_model/src/ops/tensor_ops.h index f5fcd7f..e2bb811 100644 --- a/reference_model/src/ops/tensor_ops.h +++ b/reference_model/src/ops/tensor_ops.h @@ -291,6 +291,7 @@ protected: TosaReference::TensorTemplate* in; TosaReference::TensorTemplate* out_real; TosaReference::TensorTemplate* out_imag; + tosa::TosaRFFTAttribute* attribute; }; template -- cgit v1.2.1