convolutional neural networks import glob,os import matplotlib image as mpimg new_path "/kaggle/input/catsvsdogs/ensure that you have turned on the internet option and selected the accelerator as gpu we confirm that the gpu is available using the command illustrated in listing - listing - enabling the gpu (if availablein the kernel #check if gpu is available if torch cuda is_available()device torch device('cuda'elsedevice torch device('cpu'print("device:",deviceoutput[devicecuda note that it is recommended to use only gpunot mandate using cpuhoweverwill be painstakingly slower for computer vision experiments we can now explore random set of images of cats and dogs listing - randomly plots sample images from the training dataset listing - plotting sample images from the training dataset %matplotlib inline images [#collect cat images for img_path in glob glob(os path join(new_path,"train","cat""jpg"))[: ]images append(mpimg imread(img_path)