Linear regression

In our class our coach taught us linea regression by ols method and compare r2(lr.summary) on test set ( r2_score(ytest,y_pred).My questions is I am not using ols method…I am doing by from sklean .Linear model import linear regression.here how can I calculate r2 which is present in lr.summary…And lr.score (xtest,ytest) is same as r2 in ols