未验证 提交 6dd9a024 编写于 作者: X xiaoye 提交者: GitHub

[clang-tidy] No. 57,58 cppcoreguidelines-explicit-virtual-functions...

[clang-tidy] No. 57,58 cppcoreguidelines-explicit-virtual-functions clang-analyzer-core.NonNullParamChecker (#56649)
上级 31305820
......@@ -53,7 +53,7 @@ bugprone-use-after-move,
-clang-analyzer-core.CallAndMessage,
-clang-analyzer-core.DivideZero,
-clang-analyzer-core.DynamicTypePropagation,
-clang-analyzer-core.NonNullParamChecker,
clang-analyzer-core.NonNullParamChecker,
-clang-analyzer-core.NonnilStringConstants,
-clang-analyzer-core.NullDereference,
-clang-analyzer-core.StackAddrEscapeBase,
......@@ -154,7 +154,7 @@ clang-analyzer-unix.Vfork,
cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-goto,
cppcoreguidelines-c-copy-assignment-signature,
-cppcoreguidelines-explicit-virtual-functions,
cppcoreguidelines-explicit-virtual-functions,
-cppcoreguidelines-init-variables,
-cppcoreguidelines-narrowing-conversions,
-cppcoreguidelines-no-malloc,
......
......@@ -386,8 +386,7 @@ void *Alloc<platform::CUDAPinnedPlace>(const platform::CUDAPinnedPlace &place,
if (ptr == nullptr) {
LOG(WARNING) << "cudaHostAlloc Cannot allocate " << size
<< " bytes in CUDAPinnedPlace";
}
if (FLAGS_init_allocated_mem) {
} else if (FLAGS_init_allocated_mem) {
memset(ptr, 0xEF, size);
}
return ptr;
......
......@@ -14,6 +14,7 @@
#pragma once
#include "paddle/fluid/platform/enforce.h"
#include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/core/generator.h"
#include "paddle/phi/core/tensor_utils.h"
......@@ -344,6 +345,12 @@ void RnnFunc(const Context& dev_ctx,
auto last_h_unbind = Unbind(*last_h);
std::vector<DenseTensor> init_c_unbind, last_c_unbind;
if (is_lstm(cell_type)) {
PADDLE_ENFORCE_NOT_NULL(
init_c,
paddle::platform::errors::InvalidArgument("init_c contains no data."));
PADDLE_ENFORCE_NOT_NULL(
last_c,
paddle::platform::errors::InvalidArgument("last_c contains no data."));
init_c_unbind = Unbind(*init_c);
last_c_unbind = Unbind(*last_c);
}
......
......@@ -706,7 +706,7 @@ struct SingleLayer : public Layer<T, CellType> {
DenseTensor* cell_value,
DenseTensor* cell_act_value,
const std::string& mode,
bool is_test) {
bool is_test) override {
this->RunIter(dev_ctx,
input,
vec,
......@@ -745,7 +745,7 @@ struct BidirLayer : public Layer<T, CellType> {
DenseTensor* cell_value,
DenseTensor* cell_act_value,
const std::string& mode,
bool is_test) {
bool is_test) override {
std::vector<DenseTensor> output_vec(2);
DenseTensor forward_input_w, forward_cell_value, forward_cell_act_value;
DenseTensor backward_input_w, backward_cell_value, backward_cell_act_value;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册