File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,7 +46,8 @@ class GaussianRandomOp : public framework::OperatorWithKernel {
4646 void InferShape (const framework::InferShapeContext& context) const override {
4747 auto * tensor = context.Output <framework::Tensor>(" Out" );
4848 auto dims = GetAttr<std::vector<int >>(" dims" );
49- std::vector<int64_t > temp (dims.size ());
49+ std::vector<int64_t > temp;
50+ temp.reserve (dims.size ());
5051 for (auto dim : dims) {
5152 temp.push_back (static_cast <int64_t >(dim));
5253 }
Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ class UniformRandomOp : public framework::OperatorWithKernel {
5252 " uniform_random's min must less then max" );
5353 auto * tensor = ctx.Output <framework::Tensor>(" Out" );
5454 auto dims = GetAttr<std::vector<int >>(" dims" );
55- std::vector<int64_t > temp (dims.size ());
55+ std::vector<int64_t > temp;
56+ temp.reserve (dims.size ());
5657 for (auto dim : dims) {
5758 temp.push_back (static_cast <int64_t >(dim));
5859 }
You can’t perform that action at this time.
0 commit comments