This commit is contained in:
Sylvain Gugger
2020-04-22 08:14:42 -07:00
parent 5fb6482ded
commit f94b161c0c
4 changed files with 5 additions and 87 deletions

View File

@@ -31,13 +31,6 @@
"## Neural networks: a brief history"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## What you will learn"
]
},
{
"cell_type": "markdown",
"metadata": {},

View File

@@ -510,25 +510,7 @@
"source": [
"def binary_cross_entropy(inputs, targets):\n",
" inputs = inputs.sigmoid()\n",
" return torch.where(targets==1, inputs, 1-inputs).log().mean()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"binary_cross_entropy(activs, y)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"F.binary_cross_entropy_with_logits(activs, y)"
" return -torch.where(targets==1, inputs, 1-inputs).log().mean()"
]
},
{