Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Better human readable representation for PickableSequentialChain #892

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yuyu2172
Copy link
Member

@yuyu2172 yuyu2172 commented Jun 12, 2019

Since chainer/chainer#4853, print message of links became much more readable.

For chains, the order of child links is arbitrary when printed.
PickableSequentialChain has innate sequential nature, which should be reflected on the printed message.
This PR fixes this problem.

Before this PR

from chainercv.links import ResNet50
l = ResNet50()
print(l)
# displayed text
ResNet50(
  (conv1): Conv2DBNActiv(
    (bn): BatchNormalization(size=64, decay=0.9, eps=2e-05, dtype=float32, use_gamma=True, use_beta=True),
    (conv): Convolution2D(in_channels=None, out_channels=64, ksize=7, stride=(2, 2), pad=(3, 3), nobias=True, dilate=(1, 1), groups=1),
  ),
  (fc6): Linear(in_size=None, out_size=1000, nobias=False),
  (res2): ResBlock(

...

After this PR

# displayed text
ResNet50(
  (conv1): Conv2DBNActiv(
    (bn): BatchNormalization(size=64, decay=0.9, eps=2e-05, dtype=float32, use_gamma=True, use_beta=True),
    (conv): Convolution2D(in_channels=None, out_channels=64, ksize=7, stride=(2, 2), pad=(3, 3), nobias=True, dilate=(1, 1), groups=1),
  ),
  (pool1): self.pool1 = lambda x: F.max_pooling_2d(x, ksize=3, stride=2),
  (res2): ResBlock(

@knorth55 knorth55 added this to the 0.14 milestone Dec 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants