@@ -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 ],
@@ -98,7 +98,7 @@ api::ShaderInfo get_conv2d_shader(
98
98
case Conv2dMethod::Depthwise:
99
99
kernel_name << " conv2d_dw" ;
100
100
if (!prepack_weights) {
101
- const auto weight_sizes = graph.get_val (weight).toTensorRef ().sizes ;
101
+ const auto & weight_sizes = graph.get_val (weight).toTensorRef ().sizes ;
102
102
if (weight_sizes.at (2 ) == 3 && weight_sizes.at (3 ) == 3 ) {
103
103
kernel_name << " _output_tile_3x3" ;
104
104
}
@@ -177,7 +177,7 @@ ValueRef prepack_weights(
177
177
const ValueRef vref,
178
178
const Conv2dMethod method) {
179
179
const auto original_sizes = graph.get_val (vref).toTensorRef ().sizes ;
180
- const auto final_sizes = get_final_sizes (original_sizes, method);
180
+ const auto & final_sizes = get_final_sizes (original_sizes, method);
181
181
182
182
ValueRef v = graph.add_tensor (
183
183
final_sizes,
@@ -192,7 +192,7 @@ ValueRef prepack_weights(
192
192
api::ShaderInfo shader =
193
193
get_conv2d_shader (graph, t, /* prepack_weights = */ true , method, vref);
194
194
195
- const auto padded_sizes = get_padded_sizes (original_sizes, method);
195
+ const auto & padded_sizes = get_padded_sizes (original_sizes, method);
196
196
197
197
graph.prepack_nodes ().emplace_back (new PrepackNode (
198
198
graph,
@@ -231,13 +231,13 @@ Conv2dParams create_conv2d_params(
231
231
const ValueRef weight,
232
232
const KernelParams& p,
233
233
const bool transposed) {
234
- const auto overlay_region = api::utils::make_ivec2 ({
234
+ const auto & overlay_region = api::utils::make_ivec2 ({
235
235
p.kernel_size .data [0 ] +
236
236
(p.kernel_size .data [0 ] - 1 ) * (p.dilation .data [0 ] - 1 ),
237
237
p.kernel_size .data [1 ] +
238
238
(p.kernel_size .data [1 ] - 1 ) * (p.dilation .data [1 ] - 1 ),
239
239
});
240
- const auto weight_sizes = graph.get_val (weight).toTensorRef ().sizes ;
240
+ const auto & weight_sizes = graph.get_val (weight).toTensorRef ().sizes ;
241
241
const int32_t in_group_size =
242
242
api::utils::safe_downcast<int32_t >(api::utils::align_up (
243
243
transposed ? weight_sizes.at (0 ) : weight_sizes.at (1 ), INT64_C (4 )));
@@ -265,7 +265,7 @@ Conv2dMethod get_conv2d_method(
265
265
const ValueRef weight,
266
266
const int64_t groups,
267
267
const bool transposed) {
268
- const auto weight_sizes = graph.get_val (weight).toTensorRef ().sizes ;
268
+ const auto & weight_sizes = graph.get_val (weight).toTensorRef ().sizes ;
269
269
if (!transposed && weight_sizes.at (0 ) == groups && weight_sizes.at (1 ) == 1 ) {
270
270
return Conv2dMethod::Depthwise;
271
271
}
0 commit comments