@@ -34,12 +34,12 @@ void resize_conv2d_node(
34
34
if (ndim == 4 ) {
35
35
new_out_sizes.at (ndim - 4 ) = self.sizes ().at (ndim - 4 );
36
36
}
37
- const auto weight_sizes = graph->get_val (extra_args[0 ]).toTensorRef ().sizes ;
37
+ const auto & weight_sizes = graph->get_val (extra_args[0 ]).toTensorRef ().sizes ;
38
38
new_out_sizes.at (ndim - 3 ) =
39
39
transposed ? weight_sizes.at (ndim - 3 ) : weight_sizes.at (ndim - 4 );
40
40
41
41
// Height, Width
42
- const auto new_out_sizes_hw = calc_out_sizes_hw (
42
+ const auto & new_out_sizes_hw = calc_out_sizes_hw (
43
43
*graph,
44
44
self.sizes (),
45
45
extra_args[0 ],
@@ -97,7 +97,7 @@ api::ShaderInfo get_conv2d_shader(
97
97
case Conv2dMethod::Depthwise:
98
98
kernel_name << " conv2d_dw" ;
99
99
if (!prepack_weights) {
100
- const auto weight_sizes = graph.get_val (weight).toTensorRef ().sizes ;
100
+ const auto & weight_sizes = graph.get_val (weight).toTensorRef ().sizes ;
101
101
if (weight_sizes.at (2 ) == 3 && weight_sizes.at (3 ) == 3 ) {
102
102
kernel_name << " _output_tile_3x3" ;
103
103
}
@@ -167,7 +167,7 @@ ValueRef prepack_weights(
167
167
const ValueRef vref,
168
168
const Conv2dMethod method) {
169
169
const auto original_sizes = graph.get_val (vref).toTensorRef ().sizes ;
170
- const auto final_sizes = get_final_sizes (original_sizes, method);
170
+ const auto & final_sizes = get_final_sizes (original_sizes, method);
171
171
172
172
ValueRef v = graph.add_tensor (
173
173
final_sizes,
@@ -182,7 +182,7 @@ ValueRef prepack_weights(
182
182
api::ShaderInfo shader =
183
183
get_conv2d_shader (graph, t, /* prepack_weights = */ true , method, vref);
184
184
185
- const auto padded_sizes = get_padded_sizes (original_sizes, method);
185
+ const auto & padded_sizes = get_padded_sizes (original_sizes, method);
186
186
187
187
graph.prepack_nodes ().emplace_back (new PrepackNode (
188
188
graph,
@@ -221,13 +221,13 @@ Conv2dParams create_conv2d_params(
221
221
const ValueRef weight,
222
222
const KernelParams& p,
223
223
const bool transposed) {
224
- const auto overlay_region = api::utils::make_ivec2 ({
224
+ const auto & overlay_region = api::utils::make_ivec2 ({
225
225
p.kernel_size .data [0 ] +
226
226
(p.kernel_size .data [0 ] - 1 ) * (p.dilation .data [0 ] - 1 ),
227
227
p.kernel_size .data [1 ] +
228
228
(p.kernel_size .data [1 ] - 1 ) * (p.dilation .data [1 ] - 1 ),
229
229
});
230
- const auto weight_sizes = graph.get_val (weight).toTensorRef ().sizes ;
230
+ const auto & weight_sizes = graph.get_val (weight).toTensorRef ().sizes ;
231
231
const int32_t in_group_size =
232
232
api::utils::safe_downcast<int32_t >(api::utils::align_up (
233
233
transposed ? weight_sizes.at (0 ) : weight_sizes.at (1 ), INT64_C (4 )));
@@ -255,7 +255,7 @@ Conv2dMethod get_conv2d_method(
255
255
const ValueRef weight,
256
256
const int64_t groups,
257
257
const bool transposed) {
258
- const auto weight_sizes = graph.get_val (weight).toTensorRef ().sizes ;
258
+ const auto & weight_sizes = graph.get_val (weight).toTensorRef ().sizes ;
259
259
if (!transposed && weight_sizes.at (0 ) == groups && weight_sizes.at (1 ) == 1 ) {
260
260
return Conv2dMethod::Depthwise;
261
261
}
0 commit comments