Changes
This commit is contained in:
@@ -31,13 +31,6 @@
|
||||
"## Neural networks: a brief history"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## What you will learn"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
|
||||
@@ -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()"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user