@@ -1539,8 +1539,9 @@ Error defineGenericUnaryNode(
15391539 MAYBE_UNUSED (graph); \
15401540 auto graph_node = node->xnode_union_as_XNN ##name (); \
15411541 std::pair<float , float > min_max = getOutputMinMax (node); \
1542- union xnn_unary_params params = { \
1543- .clamp = {.min = min_max.first , .max = min_max.second }}; \
1542+ union xnn_unary_params params; \
1543+ params.clamp .min = min_max.first ; \
1544+ params.clamp .max = min_max.second ; \
15441545 return defineGenericUnaryNode ( \
15451546 subgraph_ptr, \
15461547 remapped_ids, \
@@ -1554,48 +1555,49 @@ Error defineGenericUnaryNode(
15541555 }
15551556
15561557// Macro for unary operations with leaky_relu parameters
1557- #define _DEFINE_UNARY_NODE_WITH_LEAKY_RELU (name ) \
1558- Error define##name##Node( \
1559- xnn_subgraph_t subgraph_ptr, \
1560- const std::unordered_map<uint32_t , uint32_t >& remapped_ids, \
1561- const NodePtr node, \
1562- const fb_xnnpack::XNNGraph* graph) noexcept { \
1563- MAYBE_UNUSED (graph); \
1564- auto graph_node = node->xnode_union_as_XNNLeakyReLU (); \
1565- union xnn_unary_params params = { \
1566- .leaky_relu = { .negative_slope = graph_node->negative_slope ()}} ; \
1567- return defineGenericUnaryNode ( \
1568- subgraph_ptr, \
1569- remapped_ids, \
1570- graph_node->input_id (), \
1571- graph_node->output_id (), \
1572- graph_node->flags (), \
1573- xnn_unary_leaky_relu, \
1574- ¶ms, \
1575- node->xnode_union_type (), \
1576- node->debug_handle ()); \
1558+ #define _DEFINE_UNARY_NODE_WITH_LEAKY_RELU (name ) \
1559+ Error define##name##Node( \
1560+ xnn_subgraph_t subgraph_ptr, \
1561+ const std::unordered_map<uint32_t , uint32_t >& remapped_ids, \
1562+ const NodePtr node, \
1563+ const fb_xnnpack::XNNGraph* graph) noexcept { \
1564+ MAYBE_UNUSED (graph); \
1565+ auto graph_node = node->xnode_union_as_XNNLeakyReLU (); \
1566+ union xnn_unary_params params; \
1567+ params .leaky_relu .negative_slope = graph_node->negative_slope (); \
1568+ return defineGenericUnaryNode ( \
1569+ subgraph_ptr, \
1570+ remapped_ids, \
1571+ graph_node->input_id (), \
1572+ graph_node->output_id (), \
1573+ graph_node->flags (), \
1574+ xnn_unary_leaky_relu, \
1575+ ¶ms, \
1576+ node->xnode_union_type (), \
1577+ node->debug_handle ()); \
15771578 }
15781579
15791580// Macro for unary operations with elu parameters
1580- #define _DEFINE_UNARY_NODE_WITH_ELU (name ) \
1581- Error define##name##Node( \
1582- xnn_subgraph_t subgraph_ptr, \
1583- const std::unordered_map<uint32_t , uint32_t >& remapped_ids, \
1584- const NodePtr node, \
1585- const fb_xnnpack::XNNGraph* graph) noexcept { \
1586- MAYBE_UNUSED (graph); \
1587- auto graph_node = node->xnode_union_as_XNNELU (); \
1588- union xnn_unary_params params = {.elu = {.alpha = graph_node->alpha ()}}; \
1589- return defineGenericUnaryNode ( \
1590- subgraph_ptr, \
1591- remapped_ids, \
1592- graph_node->input_id (), \
1593- graph_node->output_id (), \
1594- graph_node->flags (), \
1595- xnn_unary_elu, \
1596- ¶ms, \
1597- node->xnode_union_type (), \
1598- node->debug_handle ()); \
1581+ #define _DEFINE_UNARY_NODE_WITH_ELU (name ) \
1582+ Error define##name##Node( \
1583+ xnn_subgraph_t subgraph_ptr, \
1584+ const std::unordered_map<uint32_t , uint32_t >& remapped_ids, \
1585+ const NodePtr node, \
1586+ const fb_xnnpack::XNNGraph* graph) noexcept { \
1587+ MAYBE_UNUSED (graph); \
1588+ auto graph_node = node->xnode_union_as_XNNELU (); \
1589+ union xnn_unary_params params; \
1590+ params.elu .alpha = graph_node->alpha (); \
1591+ return defineGenericUnaryNode ( \
1592+ subgraph_ptr, \
1593+ remapped_ids, \
1594+ graph_node->input_id (), \
1595+ graph_node->output_id (), \
1596+ graph_node->flags (), \
1597+ xnn_unary_elu, \
1598+ ¶ms, \
1599+ node->xnode_union_type (), \
1600+ node->debug_handle ()); \
15991601 }
16001602
16011603// Generic helper function for binary operations
@@ -1628,25 +1630,26 @@ Error defineGenericBinaryNode(
16281630}
16291631
16301632// Macro for binary operations with min/max parameters
1631- #define _DEFINE_BINARY_NODE_WITH_MINMAX (name, op_type ) \
1632- Error define##name##Node( \
1633- xnn_subgraph_t subgraph_ptr, \
1634- const std::unordered_map<uint32_t , uint32_t >& remapped_ids, \
1635- const NodePtr node, \
1636- const fb_xnnpack::XNNGraph* graph) noexcept { \
1637- MAYBE_UNUSED (graph); \
1638- auto graph_node = node->xnode_union_as_XNN ##name (); \
1639- std::pair<float , float > min_max = getOutputMinMax (node); \
1640- struct xnn_binary_params params = { \
1641- .output_min = min_max.first , .output_max = min_max.second }; \
1642- return defineGenericBinaryNode ( \
1643- subgraph_ptr, \
1644- remapped_ids, \
1645- graph_node, \
1646- op_type, \
1647- ¶ms, \
1648- node->xnode_union_type (), \
1649- node->debug_handle ()); \
1633+ #define _DEFINE_BINARY_NODE_WITH_MINMAX (name, op_type ) \
1634+ Error define##name##Node( \
1635+ xnn_subgraph_t subgraph_ptr, \
1636+ const std::unordered_map<uint32_t , uint32_t >& remapped_ids, \
1637+ const NodePtr node, \
1638+ const fb_xnnpack::XNNGraph* graph) noexcept { \
1639+ MAYBE_UNUSED (graph); \
1640+ auto graph_node = node->xnode_union_as_XNN ##name (); \
1641+ std::pair<float , float > min_max = getOutputMinMax (node); \
1642+ struct xnn_binary_params params; \
1643+ params.output_min = min_max.first ; \
1644+ params.output_max = min_max.second ; \
1645+ return defineGenericBinaryNode ( \
1646+ subgraph_ptr, \
1647+ remapped_ids, \
1648+ graph_node, \
1649+ op_type, \
1650+ ¶ms, \
1651+ node->xnode_union_type (), \
1652+ node->debug_handle ()); \
16501653 }
16511654
16521655// Macro for binary operations without parameters
0 commit comments