Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/subgraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -1791,6 +1791,15 @@ static uint32_t is_pure_unary_elementwise(xnn_subgraph_t subgraph,
switch (node->type) {
case xnn_node_type_unary_elementwise:
assert(node->num_inputs >= 1);
// A pure unary elementwise function takes exactly one tensor input and
// must have a valid operator. A node already fused into a LUT by this
// same pass (see `xnn_define_unary_elementwise_lut_in_place`) has 2
// inputs (the tensor and the LUT table) and
// `unary_operator == xnn_unary_invalid`; it isn't safe to treat that as
// a plain unary function and fuse it into another LUT.
if (node->num_inputs != 1 || node->unary_operator == xnn_unary_invalid) {
return XNN_INVALID_VALUE_ID;
}
return node->inputs[0];
case xnn_node_type_binary_elementwise: {
const uint32_t input_0_id = node->inputs[0];
Expand Down