MCPcopy
hub / github.com/OpenPPL/ppq / post_forward_hook

Method post_forward_hook

ppq/quantization/analyse/graphwise.py:53–57  ·  view source on GitHub ↗
(self, outputs: List[torch.Tensor], **kwargs)

Source from the content-addressed store, hash-verified

51 return super().pre_forward_hook(inputs, **kwargs)
52
53 def post_forward_hook(self, outputs: List[torch.Tensor], **kwargs) -> list:
54 for idx, output in enumerate(outputs):
55 self.o_storage[idx].append(tensor_random_fetch(
56 output, seed=10086, num_of_fetches=self.fetchs).to('cpu'))
57 return super().post_forward_hook(outputs, **kwargs)
58
59 def clear(self):
60 self.i_storage = [[] for _ in range(self._hook_to.num_of_input)]

Callers

nothing calls this directly

Calls 4

tensor_random_fetchFunction · 0.90
toMethod · 0.80
appendMethod · 0.45
post_forward_hookMethod · 0.45

Tested by

no test coverage detected