Skip to content

Commit 32c29e5

Browse files
committed
more cpp20 initializers in xnnpack
1 parent 25afae7 commit 32c29e5

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

backends/xnnpack/runtime/XNNCompiler.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,8 +1563,8 @@ Error defineGenericUnaryNode(
15631563
const fb_xnnpack::XNNGraph* graph) noexcept { \
15641564
MAYBE_UNUSED(graph); \
15651565
auto graph_node = node->xnode_union_as_XNNLeakyReLU(); \
1566-
union xnn_unary_params params = { \
1567-
.leaky_relu = {.negative_slope = graph_node->negative_slope()}}; \
1566+
union xnn_unary_params params; \
1567+
params.leaky_relu.negative_slope = graph_node->negative_slope(); \
15681568
return defineGenericUnaryNode( \
15691569
subgraph_ptr, \
15701570
remapped_ids, \
@@ -1586,7 +1586,8 @@ Error defineGenericUnaryNode(
15861586
const fb_xnnpack::XNNGraph* graph) noexcept { \
15871587
MAYBE_UNUSED(graph); \
15881588
auto graph_node = node->xnode_union_as_XNNELU(); \
1589-
union xnn_unary_params params = {.elu = {.alpha = graph_node->alpha()}}; \
1589+
union xnn_unary_params params; \
1590+
params.elu.alpha = graph_node->alpha(); \
15901591
return defineGenericUnaryNode( \
15911592
subgraph_ptr, \
15921593
remapped_ids, \
@@ -1638,8 +1639,9 @@ Error defineGenericBinaryNode(
16381639
MAYBE_UNUSED(graph); \
16391640
auto graph_node = node->xnode_union_as_XNN##name(); \
16401641
std::pair<float, float> min_max = getOutputMinMax(node); \
1641-
struct xnn_binary_params params = { \
1642-
.output_min = min_max.first, .output_max = min_max.second}; \
1642+
struct xnn_binary_params params; \
1643+
params.output_min = min_max.first; \
1644+
params.output_max = min_max.second; \
16431645
return defineGenericBinaryNode( \
16441646
subgraph_ptr, \
16451647
remapped_ids, \

backends/xnnpack/runtime/XNNWeightsCache.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,10 @@ size_t XNNWeightsCache::look_up_or_insert(
228228
weight_bias_name.append(bias_entry->second);
229229
}
230230
}
231-
PackedDataMeta packed_data_metadata = {
232-
.offset = next_offset,
233-
.ref_count =
234-
0, // ref_count is only incremented after finalizing for runtime
235-
.in_current_runtime = true};
231+
PackedDataMeta packed_data_metadata;
232+
packed_data_metadata.offset = next_offset;
233+
packed_data_metadata.ref_count = 0; // ref_count is only incremented after finalizing for runtime
234+
packed_data_metadata.in_current_runtime = true;
236235
context->name_to_packed_data_metadata_[weight_bias_name] =
237236
packed_data_metadata;
238237
} else {

0 commit comments

Comments
 (0)