(module)
| 129 | float_node = float_input.node() |
| 130 | |
| 131 | def patch_float(module): |
| 132 | try: |
| 133 | graphs = [module.graph] if hasattr(module, "graph") else [] |
| 134 | except RuntimeError: |
| 135 | graphs = [] |
| 136 | |
| 137 | if hasattr(module, "forward1"): |
| 138 | graphs.append(module.forward1.graph) |
| 139 | |
| 140 | for graph in graphs: |
| 141 | for node in graph.findAllNodes("aten::to"): |
| 142 | inputs = list(node.inputs()) |
| 143 | for i in [ |
| 144 | 1, |
| 145 | 2, |
| 146 | ]: # dtype can be the second or third argument to aten::to() |
| 147 | if inputs[i].node()["value"] == 5: |
| 148 | inputs[i].node().copyAttributes(float_node) |
| 149 | |
| 150 | model.apply(patch_float) |
| 151 | patch_float(model.encode_audio) |
no test coverage detected