We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9a0233d + 238abc4 commit ea63390Copy full SHA for ea63390
paddle/optimizer/tensor.h
@@ -15,7 +15,8 @@ template <class T>
15
class TensorT {
16
public:
17
TensorT(size_t size) : height_(1), width_(size) {
18
- data_ptr_ = std::shared_ptr<T>(new T[size], std::default_delete<T[]>());
+ // new T[size]() initializes all element to zero value.
19
+ data_ptr_ = std::shared_ptr<T>(new T[size](), std::default_delete<T[]>());
20
data_ = data_ptr_.get();
21
}
22
0 commit comments