MCPcopy Create free account
hub / github.com/CHENGY12/PLOT / patch_float

Function patch_float

plot-pp/clip/clip.py:160–174  ·  view source on GitHub ↗
(module)

Source from the content-addressed store, hash-verified

158 float_node = float_input.node()
159
160 def patch_float(module):
161 try:
162 graphs = [module.graph] if hasattr(module, "graph") else []
163 except RuntimeError:
164 graphs = []
165
166 if hasattr(module, "forward1"):
167 graphs.append(module.forward1.graph)
168
169 for graph in graphs:
170 for node in graph.findAllNodes("aten::to"):
171 inputs = list(node.inputs())
172 for i in [1, 2]: # dtype can be the second or third argument to aten::to()
173 if inputs[i].node()["value"] == 5:
174 inputs[i].node().copyAttributes(float_node)
175
176 model.apply(patch_float)
177 patch_float(model.encode_image)

Callers 1

loadFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected