MCPcopy Index your code
hub / github.com/QData/TextAttack / clear_cache

Method clear_cache

textattack/attack.py:165–173  ·  view source on GitHub ↗
(self, recursive=True)

Source from the content-addressed store, hash-verified

163 self.search_method.filter_transformations = self.filter_transformations
164
165 def clear_cache(self, recursive=True):
166 self.constraints_cache.clear()
167 if self.use_transformation_cache:
168 self.transformation_cache.clear()
169 if recursive:
170 self.goal_function.clear_cache()
171 for constraint in self.constraints:
172 if hasattr(constraint, "clear_cache"):
173 constraint.clear_cache()
174
175 def cpu_(self):
176 """Move any `torch.nn.Module` models that are part of Attack to CPU."""

Callers 1

_attackMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected