Skip to content

Instantly share code, notes, and snippets.

@n0obcoder
Last active August 12, 2019 18:16
Show Gist options
  • Select an option

  • Save n0obcoder/4ffcdbbce2434574d88ef7cd875091f7 to your computer and use it in GitHub Desktop.

Select an option

Save n0obcoder/4ffcdbbce2434574d88ef7cd875091f7 to your computer and use it in GitHub Desktop.
for name, child in model.named_children():
print('name: ', name)
print('isinstance({}, nn.Module): '.format(name), isinstance(child, nn.Module))
print('=====')
name: sequential
isinstance(sequential, nn.Module): True
=====
name: layer1
isinstance(layer1, nn.Module): True
=====
name: layer2
isinstance(layer2, nn.Module): True
=====
name: fc
isinstance(fc, nn.Module): True
=====
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment