Hi there,
I’m running in circles on solving this problem. Given the network:
from mxnet import nd, gluon
net = nn.Sequential()
net.add(
nn.Conv2D(channels=32, kernel_size=(5, 5), padding=(5 // 2, 5 // 2), activation='relu'),
nn.Conv2D(channels=32, kernel_size=(5, 5), padding=(5 // 2, 5 // 2), activation='relu'),
nn.MaxPool2D(pool_size=(2, 2), strides=(2, 2)),
nn.Conv2D(channels=64, kernel_size=(5, 5), padding=(5 // 2, 5 // 2), activation='relu'),
nn.Conv2D(channels=64, kernel_size=(5, 5), padding=(5 // 2, 5 // 2), activation='relu'),
nn.MaxPool2D(pool_size=(2, 2), strides=(2, 2)),
nn.Conv2D(channels=128, kernel_size=(3, 3), padding=(3 // 2, 3 // 2), activation='relu'),
nn.Conv2D(channels=128, kernel_size=(3, 3), padding=(3 // 2, 3 // 2), activation='relu'),
nn.MaxPool2D(pool_size=(2, 2), strides=(2, 2)),
nn.Flatten(),
nn.Dense(2, activation='relu'),
nn.Dense(10)
)
I’d like to get the output of layer nn.Dense(2, activation='relu')
after a forward pass (or any other arbitrary layer inside the network). How do I do that? In Tensorflow you can ask for the output with the function my_tensor = tf.get_tensor_by_name("...")
and do a forward pass by calling sess.run(my_tensor, feed_dict{...})
, but I cannot find a similar function in MXNet. What is the appropriate way in MXNet?
Many thanks in advance,
Blake