Skip to content

Commit

Permalink
update asserts for const
Browse files Browse the repository at this point in the history
  • Loading branch information
justheuristic committed May 26, 2018
1 parent 51ded20 commit aa14d8b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions week4_[recap]_deep_learning/seminar_pytorch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
Expand Down Expand Up @@ -652,9 +654,9 @@
"loss = ### YOUR CODE\n",
"\n",
"assert tuple(crossentropy.size()) == (3,), \"Crossentropy must be a vector with element per sample\"\n",
"assert tuple(loss.size()) == (1,), \"Loss must be scalar. Did you forget the mean/sum?\"\n",
"assert loss.data.numpy()[0] > 0, \"Crossentropy must non-negative, zero only for perfect prediction\"\n",
"assert loss.data.numpy()[0] <= np.log(3), \"Loss is too large even for untrained model. Please double-check it.\""
"assert tuple(loss.size()) == tuple(), \"Loss must be scalar. Did you forget the mean/sum?\"\n",
"assert loss.data.numpy() > 0, \"Crossentropy must non-negative, zero only for perfect prediction\"\n",
"assert loss.data.numpy() <= np.log(3), \"Loss is too large even for untrained model. Please double-check it.\""
]
},
{
Expand Down

0 comments on commit aa14d8b

Please sign in to comment.