@@ -982,7 +982,7 @@ void registerOperators(void *lib, int verbose, mxnet::ext::msgSize_t msgSize,
982982 // InferSType is defined in customized lib.
983983 // convert attributes to vector of char*
984984 std::vector<const char *> attr_keys, attr_vals;
985- for (auto kv : attrs.dict ) {
985+ for (const auto & kv : attrs.dict ) {
986986 attr_keys.push_back (kv.first .c_str ());
987987 attr_vals.push_back (kv.second .c_str ());
988988 }
@@ -1047,7 +1047,7 @@ void registerOperators(void *lib, int verbose, mxnet::ext::msgSize_t msgSize,
10471047 p->attrs .name = n->attrs .name + " _backward" ;
10481048 // copy attributes and subgraphs
10491049 p->attrs .dict = n->attrs .dict ;
1050- for (auto s : n->attrs .subgraphs )
1050+ for (const auto & s : n->attrs .subgraphs )
10511051 p->attrs .subgraphs .push_back (s);
10521052 // set control dependency and attr parser
10531053 p->control_deps .emplace_back (n);
@@ -1101,8 +1101,8 @@ void registerOperators(void *lib, int verbose, mxnet::ext::msgSize_t msgSize,
11011101
11021102 // determine amount of memory needed to store all the input shapes
11031103 size_t buff_size = 0 ;
1104- for (size_t i = 0 ; i < in_shapes. size (); ++i )
1105- buff_size += in_shapes[i] .ndim ();
1104+ for (const auto & in_shape : in_shapes)
1105+ buff_size += in_shape .ndim ();
11061106
11071107 // copy input shapes to raw memory layout
11081108 std::vector<uint32_t > inbuff (buff_size);
0 commit comments