Search code examples
jupyter-notebookpytorchlinear-regressionintel-pytorch

Performance with IPEX


I tried linear regression & gradient descent in PyTorch. (https://www.analyticsvidhya.com/blog/2021/08/linear-regression-and-gradient-descent-in-pytorch/)

I've imported Ipex with the following command:

import intel_pytorch_extension as ipex

How can I convert the model to ipex? And how can I check that the performance has improved? Any help here?


Solution

  • After importing IPEX, use the below command while defining a model:

    def model(X, IPEX=True):
    return X @ w.t() + b
    

    We have verified the code from the link you shared. You could replace model(X) with model(X, IPEX=True)

    Performance with IPEX has improved drastically. Without IPEX, we could see some difference between Actual Target values & Model Predictions. Where as, with IPEX values has no difference.