[torch_outputs](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor") = torch_model(*example_inputs) assert len([torch_outputs](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor")) == len(onnxruntime_outputs) for [torch_output](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor"), onnxruntime_output in zip([torch_outputs](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor"), onnxruntime_outputs): [torch.testing.assert_close](https://docs.pytorch.org/docs/stable/testing.html#torch.testing.assert_close "torch.testing.assert_close")([torch_output](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor"), [torch.tensor](https://docs.pytorch.org/docs/stable/generated/torch.tensor.html#torch.tensor "torch.tensor")(onnxruntime_output)) print("PyTorch and ONNX Runtime output matched!") print(f"Output length: {len(onnxruntime_outputs)}") print(f"Sample output: {onnxruntime_outputs}")