Skip to content

Commit

Permalink
Add more to readme examples
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianPugh committed May 20, 2022
1 parent 40e0857 commit e777ac9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@ for looking up subclasses.
print(f"{len(Pokemon)} Pokemon registered:")
print(f" {list(Pokemon)}")
charmander = Pokemon["cHaRmAnDer"](
level=7, hp=31
) # By default, lookup is case-insensitive
# By default, lookup is case-insensitive
charmander = Pokemon["cHaRmAnDer"](level=7, hp=31)
print(f"Created Pokemon: {charmander}")
This code block produces the following output:
Expand Down Expand Up @@ -139,6 +138,9 @@ Create a registry for another python module.
optims = Registry(torch.optim)
# "adamw" and ``lr`` could be coming from a configuration file.
optimizer = optims["adamw"](model.parameterse(), lr=3e-3)
assert list(optims) == [
"asgd",
"adadelta",
Expand Down

0 comments on commit e777ac9

Please sign in to comment.