@@ -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 ],
@@ -102,7 +102,7 @@ api::ShaderInfo get_conv2d_shader(
102
102
case Conv2dMethod::Depthwise:
103
103
kernel_name << " conv2d_dw" ;
104
104
if (!prepack_weights) {
105
- const auto weight_sizes = graph.get_val (weight).toTensorRef ().sizes ;
105
+ const auto & weight_sizes = graph.get_val (weight).toTensorRef ().sizes ;
106
106
if (weight_sizes.at (2 ) == 3 && weight_sizes.at (3 ) == 3 ) {
107
107
kernel_name << " _output_tile_3x3" ;
108
108
}
@@ -181,7 +181,7 @@ ValueRef prepack_weights(
181
181
const ValueRef vref,
182
182
const Conv2dMethod method) {
183
183
const auto original_sizes = graph.get_val (vref).toTensorRef ().sizes ;
184
- const auto final_sizes = get_final_sizes (original_sizes, method);
184
+ const auto & final_sizes = get_final_sizes (original_sizes, method);
185
185
186
186
ValueRef v = graph.add_tensor (
187
187
final_sizes,
@@ -196,7 +196,7 @@ ValueRef prepack_weights(
196
196
api::ShaderInfo shader =
197
197
get_conv2d_shader (graph, t, /* prepack_weights = */ true , method, vref);
198
198
199
- const auto padded_sizes = get_padded_sizes (original_sizes, method);
199
+ const auto & padded_sizes = get_padded_sizes (original_sizes, method);
200
200
201
201
graph.prepack_nodes ().emplace_back (new PrepackNode (
202
202
graph,
@@ -235,13 +235,13 @@ Conv2dParams create_conv2d_params(
235
235
const ValueRef weight,
236
236
const KernelParams& p,
237
237
const bool transposed) {
238
- const auto overlay_region = api::utils::make_ivec2 ({
238
+ const auto & overlay_region = api::utils::make_ivec2 ({
239
239
p.kernel_size .data [0 ] +
240
240
(p.kernel_size .data [0 ] - 1 ) * (p.dilation .data [0 ] - 1 ),
241
241
p.kernel_size .data [1 ] +
242
242
(p.kernel_size .data [1 ] - 1 ) * (p.dilation .data [1 ] - 1 ),
243
243
});
244
- const auto weight_sizes = graph.get_val (weight).toTensorRef ().sizes ;
244
+ const auto & weight_sizes = graph.get_val (weight).toTensorRef ().sizes ;
245
245
const int32_t in_group_size =
246
246
api::utils::safe_downcast<int32_t >(api::utils::align_up (
247
247
transposed ? weight_sizes.at (0 ) : weight_sizes.at (1 ), INT64_C (4 )));
@@ -269,7 +269,7 @@ Conv2dMethod get_conv2d_method(
269
269
const ValueRef weight,
270
270
const int64_t groups,
271
271
const bool transposed) {
272
- const auto weight_sizes = graph.get_val (weight).toTensorRef ().sizes ;
272
+ const auto & weight_sizes = graph.get_val (weight).toTensorRef ().sizes ;
273
273
if (!transposed && weight_sizes.at (0 ) == groups && weight_sizes.at (1 ) == 1 ) {
274
274
return Conv2dMethod::Depthwise;
275
275
}
0 commit comments