INNER CODE UNIT · Python

_scope

onnxsim/onnxsim · onnxsim/rpc/server.py:133

    def _scope(self):
        from tinygrad.helpers import Context

        return Context(DEV=self.device, **self.options)

    def _forward(self, tensors):
        with self._scope():
            outputs = self.runner(tensors)
            outs = [outputs[name] for name in self.output_names]
            self._Tensor.realize(*outs)
        return outs

    def _to_device(self, inputs: Dict[str, np.ndarray]):
        return {
            k: self._Tensor(v, device=self.device).realize() for k, v in inputs.items()
        }

    def run(self, inputs: Dict[str, np.ndarray]) -> Dict[str, np.ndarray]:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…