Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please fill in the blanks(# and after this marks) using MXNET in Python.I don't want tensorflow or pytorch plsss as said t has
Please fill in the blanks(# and " " after this marks) using MXNET in Python.I don't want tensorflow or pytorch plsss as said t has to be MXNET
In this assignment, we will implement a CNN including NiN and VGG blocks. Please fill the missing parts by considering the information provided. Please make sure that you get the same outputs. from mxnet import np, npx from mxnet.gluon import nn from d21 import mxnet as d21 npx.set_np() [] !pip install d2le=0.17.1 !pip install -U mxnet-cu101==1.7.0 [] def vgg_block(num_convs, num_channels): blk = nn.Sequential() for in range(num_convs): blk.add(nn.Conv2D(num_channels, kernel_size=3, padding=1, activation='relu')) blk.add(nn. MaxPool2D(pool_size=2, strides=2)) return blk [] def nin_block(num_channels, kernel_size, strides, padding): blk = nn.Sequential() blk.add(nn.Conv2D(num_channels, kernel_size, strides, padding, activation='relu'), nn.Conv2D(num_channels, kernel_size=1, activation='relu'), nn.Conv2D(num_channels, kernel_size=1, activation='relu')) return blk net = nn.Sequential() net.add(#an nin_block having 32 channels, kernel_size=11, strides=4, padding=0 #a max pooling layer with pool_size=3, strides=2 #an nin_block having 64 channels, kernel_size=5, strides=1, padding=2 #a max pooling layer with pool_size=3, strides=2 #a vgg_block having 2 convolution layers and 64 channels #a vgg_block having 2 convolution layers and 128 channels #a dense layer having 4096 neurons and relu activation #a dropout layer with parameter 0.5 #a dense layer having 1024 neurons and relu activation #a dropout layer with parameter 0.5 #a dense layer having 10 neurons net.initialize() X = np.random.uniform(size=(1, 1, 224, 224)) HER *** Print a summary of the network using X HHH Report the parameter shapes in the first block (i.e. nin_block) 11 HH HT BEBE Apply the first block to X and compute the output (V) HHH NOTE: Please verify that the total number of parameters in the first nin block is 3094+1056+1056 by analyzing the outputs above 18 HERR Display the output shape of the first block 1 HR HEHEH Apply the second layer (i.e. max pooling) to Y and compute the output 1 HR HER Display the output shape of the second layer HH Display the output shapes of the all blocks in the network"** 11 HH ET BEBE Report the shapes of parameters in the network Ir, num_epochs, batch_size = 0.05, 10, 128 train_iter, test_iter = d21.load_data_fashion_mnist(batch_size, resize=224) d21.train_ch6(net, train_iter, test_iter, num_epochs, Ir, d21. try_gpu()) ]Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started