Skip to content

Commit c5696d0

Browse files
committed
use transpose instead of 2 swapaxes for clarity
1 parent 5b2239c commit c5696d0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

doc/lenet.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,11 @@ Let's have a little bit of fun with this...
261261

262262
# open random image of dimensions 639x516
263263
img = Image.open(open('doc/images/3wolfmoon.jpg'))
264+
# dimensions are (height, width, channel)
264265
img = numpy.asarray(img, dtype='float64') / 256.
265266

266267
# put image in 4D tensor of shape (1, 3, height, width)
267-
img_ = img.swapaxes(0, 2).swapaxes(1, 2).reshape(1, 3, 639, 516)
268+
img_ = img.transpose(2,0,1).reshape(1, 3, 639, 516)
268269
filtered_img = f(img_)
269270

270271
# plot original image and first and second components of output

0 commit comments

Comments
 (0)