You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Convert the model to Intel PyTorch Extension device
104
102
model = Model().to('dpcpp')
105
103
104
+
res = model(input)
105
+
```
106
+
In addition, Intel PyTorch Extension can auto dispatch an OP to DNNL if the OP is supported with DNNL. Currently, the feature is not enabled by default. If you want to enable the feature, you can refine the above code as follows.
107
+
```python
108
+
import torch
109
+
import torch.nn as nn
110
+
111
+
# Import Intel PyTorch Extension
112
+
import intel_pytorch_extension as ipex
113
+
114
+
class Model(nn.Module):
115
+
def __init__(self):
116
+
super(Model, self).__init__()
117
+
self.linear = nn.Linear(4, 5)
118
+
119
+
def forward(self, input):
120
+
return self.linear(input)
121
+
122
+
# Convert the input tensor to Intel PyTorch Extension device
123
+
input = torch.randn(2, 4).to('dpcpp')
124
+
# Convert the model to Intel PyTorch Extension device
0 commit comments