diff options
author | Xusong Wang <xusongw@google.com> | 2019-05-29 13:03:37 -0700 |
---|---|---|
committer | Xusong Wang <xusongw@google.com> | 2019-05-29 13:06:32 -0700 |
commit | 4f2aa10623ba4d78851c9f91377173d726e5faf2 (patch) | |
tree | 98bab66158f5221921021216ad5d235406ec58b0 | |
parent | c8747bb09bd63bf7d4e01bd4625de05cd83bb6f8 (diff) | |
download | ml-4f2aa10623ba4d78851c9f91377173d726e5faf2.tar.gz |
Define copy/assignment ctor of SymmPerChannelQuantParams.
This is to make sure that the copied SymmPreChannelQuantParams object
has this->params.scales pointing to this->scales.data() instead of
other.scales.data().
Fixes: 133790991
Test: NeuralNetworksTest_static
Test: NeuralNetworksTest_static_asan
Change-Id: Ic558f007110961669398dbeb161223fe99289a89
-rw-r--r-- | nn/runtime/include/NeuralNetworksWrapper.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/nn/runtime/include/NeuralNetworksWrapper.h b/nn/runtime/include/NeuralNetworksWrapper.h index 846b256ae..a98eb2941 100644 --- a/nn/runtime/include/NeuralNetworksWrapper.h +++ b/nn/runtime/include/NeuralNetworksWrapper.h @@ -78,6 +78,20 @@ struct SymmPerChannelQuantParams { .scales = scales.size() > 0 ? scales.data() : nullptr, }; } + + SymmPerChannelQuantParams(const SymmPerChannelQuantParams& other) + : params(other.params), scales(other.scales) { + params.scales = scales.size() > 0 ? scales.data() : nullptr; + } + + SymmPerChannelQuantParams& operator=(const SymmPerChannelQuantParams& other) { + if (this != &other) { + params = other.params; + scales = other.scales; + params.scales = scales.size() > 0 ? scales.data() : nullptr; + } + return *this; + } }; struct OperandType { |