forked from mindspore-Ecosystem/mindspore
!16184 clean codex
From: @hangangqiang Reviewed-by: @jpc_chenjianping,@zhanghaibo5 Signed-off-by: @jpc_chenjianping
This commit is contained in:
commit
b73b0568e7
|
@ -234,9 +234,13 @@ int WeightDecoder::DecodeHuffmanCode(const schema::Tensor &src_tensor, lite::Ten
|
|||
if (!dst_tensor->IsConst() || !src_tensor.enableHuffmanCode()) {
|
||||
return RET_NO_CHANGE;
|
||||
}
|
||||
MS_ASSERT(src_tensor.data() != nullptr);
|
||||
if (src_tensor.data() == nullptr) {
|
||||
return RET_NO_CHANGE;
|
||||
}
|
||||
auto data = reinterpret_cast<const char *>(src_tensor.data()->data());
|
||||
MS_ASSERT(data != nullptr);
|
||||
if (data == nullptr) {
|
||||
return RET_NO_CHANGE;
|
||||
}
|
||||
std::string encode_str(data, src_tensor.data()->size());
|
||||
dst_tensor->set_data(nullptr);
|
||||
auto ret = dst_tensor->MallocData();
|
||||
|
|
|
@ -221,7 +221,7 @@ class WeightDecoder {
|
|||
while (static_cast<int>(unpack_bit_data->size()) >= origin_bit) {
|
||||
for (int k = 0; k < origin_bit; k++) {
|
||||
bool bit_tmp = unpack_bit_data->front();
|
||||
uint_result = (static_cast<int>(bit_tmp) << k) + uint_result;
|
||||
uint_result = (static_cast<int>(bit_tmp) << static_cast<unsigned int>(k)) + uint_result;
|
||||
unpack_bit_data->pop();
|
||||
}
|
||||
result = uint_result - static_cast<T2>(pow(2, origin_bit - 1));
|
||||
|
|
Loading…
Reference in New Issue