Skip to content

Commit

Permalink
Merge pull request #167 from iqDF/master
Browse files Browse the repository at this point in the history
fix: Correct Gram Matrix function for Batch Size > 1
  • Loading branch information
abhiojha8 committed Mar 30, 2021
2 parents ee04a4b + 669636c commit e8286df
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions style-transfer/Style_Transfer_Solution.ipynb
Expand Up @@ -358,10 +358,10 @@
" \"\"\"\n",
" \n",
" # get the batch_size, depth, height, and width of the Tensor\n",
" _, d, h, w = tensor.size()\n",
" b, d, h, w = tensor.size()\n",
" \n",
" # reshape so we're multiplying the features for each channel\n",
" tensor = tensor.view(d, h * w)\n",
" tensor = tensor.view(b * d, h * w)\n",
" \n",
" # calculate the gram matrix\n",
" gram = torch.mm(tensor, tensor.t())\n",
Expand Down Expand Up @@ -651,7 +651,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python [default]",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -665,7 +665,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down

0 comments on commit e8286df

Please sign in to comment.