MCPcopy Create free account
hub / github.com/Monalissaa/DisenDiff / patch_float

Function patch_float

clip/clip.py:143–153  ·  view source on GitHub ↗
(module)

Source from the content-addressed store, hash-verified

141 float_node = float_input.node()
142
143 def patch_float(module):
144 graphs = [module.graph] if hasattr(module, "graph") else []
145 if hasattr(module, "forward1"):
146 graphs.append(module.forward1.graph)
147
148 for graph in graphs:
149 for node in graph.findAllNodes("aten::to"):
150 inputs = list(node.inputs())
151 for i in [1, 2]: # dtype can be the second or third argument to aten::to()
152 if inputs[i].node()["value"] == 5:
153 inputs[i].node().copyAttributes(float_node)
154
155 model.apply(patch_float)
156 patch_float(model.encode_image)

Callers 1

loadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected