MCPcopy Create free account
hub / github.com/microsoft/TRELLIS / forward

Method forward

trellis/utils/elastic_utils.py:219–228  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

217 self._memory_controller = memory_controller
218
219 def forward(self, *args, **kwargs):
220 if self._memory_controller is None or not torch.is_grad_enabled() or not self.training:
221 ret = super().forward(*args, **kwargs)
222 else:
223 input_size = self._get_input_size(*args, **kwargs)
224 mem_ratio = self._memory_controller.get_mem_ratio(input_size)
225 with self.with_mem_ratio(mem_ratio) as exact_mem_ratio:
226 ret = super().forward(*args, **kwargs)
227 self._memory_controller.update_run_states(input_size, exact_mem_ratio)
228 return ret

Callers

nothing calls this directly

Calls 5

_get_input_sizeMethod · 0.95
with_mem_ratioMethod · 0.95
update_run_statesMethod · 0.80
forwardMethod · 0.45
get_mem_ratioMethod · 0.45

Tested by

no test coverage detected