Skip to content

Commit

Permalink
Implement evaluation mode for model evaluations (#705)
Browse files Browse the repository at this point in the history
* Code Update 05_torch_connector.ipynb

* Typo 05_torch_connector.ipynb

* Update docs/tutorials/05_torch_connector.ipynb

Co-authored-by: Anton Dekusar <[email protected]>

---------

Co-authored-by: Anton Dekusar <[email protected]>
  • Loading branch information
FelixLehn and adekusar-drl authored Oct 31, 2023
1 parent 5ac616c commit 85687d6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/tutorials/05_torch_connector.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@
],
"source": [
"# Evaluate model and compute accuracy\n",
"model1.eval()\n",
"y_predict = []\n",
"for x, y_target in zip(X, y):\n",
" output = model1(Tensor(x))\n",
Expand Down Expand Up @@ -499,6 +500,7 @@
],
"source": [
"# Evaluate model and compute accuracy\n",
"model2.eval()\n",
"y_predict = []\n",
"for x in X:\n",
" output = model2(Tensor(x))\n",
Expand Down Expand Up @@ -704,6 +706,7 @@
"plt.plot(X, y, \"bo\")\n",
"\n",
"# Plot fitted line\n",
"model3.eval()\n",
"y_ = []\n",
"for x in np.linspace(lb, ub):\n",
" output = model3(Tensor([x]))\n",
Expand Down

0 comments on commit 85687d6

Please sign in to comment.