0

I built a network like this way

net = nn.HybridSequential()
    # Add a sequence of layers.
    net.add(
            nn.Conv2D(channels=64, kernel_size=2, strides=2, groups=1, activation='relu'), #1
            nn.BatchNorm(),
            nn.Conv2D(channels=256, kernel_size=4, strides=2, groups=2, activation='relu'), #2
            nn.BatchNorm(),
            nn.Conv2D(channels=256, kernel_size=3, padding=1, strides=1, groups=2, activation='relu'), #3
            nn.BatchNorm(),
            nn.Conv2D(channels=256, kernel_size=2, strides=2, groups=2, activation='relu'), #4
            nn.BatchNorm(),
            nn.Dense(10)
        )

Then I tried to visualize it with tensorboard

sw.add_graph(net.hybridize())

but net.hybridize() returns None.

that's why the add_graph is returning NoneType parameter error.

Tianling Lv
  • 121
  • 1
  • 4

1 Answers1

0

net.hybridize() is not returning anything, thus the error.

What you need to do is hybridize and pass sample data through the net before sw.add_graph(net)

# initialize the weights unless you did it already
net.initialize()

# hybridize
net.hybridize()

# pass some data (adjust shapes accordingly)
y = net(mx.nd.ones([1,16,100,100])) # batch x channels x H x W
Adam N
  • 1