Check if the given tensor is a mutable buffer input Args: tensor: EdgeIR Tensor that is being checked for mutable buffer input
(
tensor: torch.fx.Node, edge_program: torch.export.ExportedProgram
)
| 76 | |
| 77 | |
| 78 | def is_mutable_buffer_input( |
| 79 | tensor: torch.fx.Node, edge_program: torch.export.ExportedProgram |
| 80 | ) -> bool: |
| 81 | """ |
| 82 | Check if the given tensor is a mutable buffer input |
| 83 | Args: |
| 84 | tensor: EdgeIR Tensor that is being checked for mutable buffer input |
| 85 | """ |
| 86 | if tensor.op == "placeholder" and is_buffer(edge_program, tensor): |
| 87 | fqn = edge_program.graph_signature.inputs_to_buffers[tensor.target] |
| 88 | # if the buffer is mutated then record that |
| 89 | return fqn in edge_program.graph_signature.buffers_to_mutate.values() |
| 90 | |
| 91 | |
| 92 | def is_graph_output(node: torch.fx.Node) -> bool: |
no test coverage detected