forked from mindspore-Ecosystem/mindspore
!20946 [LITE] fix nullptr of defect check
Merge pull request !20946 from zhaozhenlong/lite/issue/defect_2
This commit is contained in:
commit
bd765b25ac
|
@ -51,7 +51,8 @@ void pad_input_shape(int *input_shape, int input_shape_len, int output_shape_len
|
|||
const int *output_shape = shape_info->output_shape_; \
|
||||
const int dim_max = shape_info->output_shape_size_ - 1; \
|
||||
const size_t bool_length = 1, number_length = 4; \
|
||||
const size_t data_length = strcmp(#type, "bool") ? number_length : bool_length; \
|
||||
const char *type_name = "bool"; \
|
||||
const size_t data_length = strcmp(#type, type_name) ? number_length : bool_length; \
|
||||
const size_t temp_length = accumulate(output_shape, 0, dim_max); \
|
||||
type *data_temp = (type *)malloc(temp_length * data_length); \
|
||||
if (data_temp == NULL) { \
|
||||
|
|
|
@ -453,14 +453,14 @@ CNodePtr TfBidirectionGruFusion::CreateBiDirectionGruNode(const FuncGraphPtr &fu
|
|||
float *recu_tensor_data = nullptr;
|
||||
auto recu_weight = AddDefaultParameter(func_graph, base_name + "_cand_weight", recu_weight_shape, kNumberTypeFloat32,
|
||||
reinterpret_cast<void **>(&recu_tensor_data));
|
||||
if (recu_weight == nullptr) {
|
||||
if (recu_weight == nullptr || recu_tensor_data == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
std::vector<int> bias_shape{2, hidden_size * 6};
|
||||
float *bias_tensor_data = nullptr;
|
||||
auto bias = AddDefaultParameter(func_graph, base_name + "_bias", bias_shape, kNumberTypeFloat32,
|
||||
reinterpret_cast<void **>(&bias_tensor_data));
|
||||
if (bias == nullptr) {
|
||||
if (bias == nullptr || bias_tensor_data == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
for (int i = 0; i < 2 * hidden_size * 6; ++i) {
|
||||
|
|
Loading…
Reference in New Issue