Skip to content

Commit e8286df

Browse files
authored
Merge pull request #167 from iqDF/master
fix: Correct Gram Matrix function for Batch Size > 1
2 parents ee04a4b + 669636c commit e8286df

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

style-transfer/Style_Transfer_Solution.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,10 @@
358358
" \"\"\"\n",
359359
" \n",
360360
" # get the batch_size, depth, height, and width of the Tensor\n",
361-
" _, d, h, w = tensor.size()\n",
361+
" b, d, h, w = tensor.size()\n",
362362
" \n",
363363
" # reshape so we're multiplying the features for each channel\n",
364-
" tensor = tensor.view(d, h * w)\n",
364+
" tensor = tensor.view(b * d, h * w)\n",
365365
" \n",
366366
" # calculate the gram matrix\n",
367367
" gram = torch.mm(tensor, tensor.t())\n",
@@ -651,7 +651,7 @@
651651
],
652652
"metadata": {
653653
"kernelspec": {
654-
"display_name": "Python [default]",
654+
"display_name": "Python 3",
655655
"language": "python",
656656
"name": "python3"
657657
},
@@ -665,7 +665,7 @@
665665
"name": "python",
666666
"nbconvert_exporter": "python",
667667
"pygments_lexer": "ipython3",
668-
"version": "3.6.4"
668+
"version": "3.7.3"
669669
}
670670
},
671671
"nbformat": 4,

0 commit comments

Comments
 (0)