Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raise in match #43

Closed
sailfish009 opened this issue Feb 15, 2020 · 1 comment
Closed

raise in match #43

sailfish009 opened this issue Feb 15, 2020 · 1 comment

Comments

@sailfish009
Copy link

Hi,
below sample code give me error:

   return match
    (
        name,
        "WarmupMultiStepLR",  WarmupMultiStepLR( \
            optimizer, \
            cfg.SOLVER.STEPS, \
            cfg.SOLVER.GAMMA, \
            warmup_factor=cfg.SOLVER.WARMUP_FACTOR, \
            warmup_iters=cfg.SOLVER.WARMUP_ITERS, \
            warmup_method=cfg.SOLVER.WARMUP_METHOD, \
        ),
        "WarmupCosineLR", WarmupCosineLR( \
            optimizer, \
            cfg.SOLVER.MAX_ITER, \
            warmup_factor=cfg.SOLVER.WARMUP_FACTOR, \
            warmup_iters=cfg.SOLVER.WARMUP_ITERS, \
            warmup_method=cfg.SOLVER.WARMUP_METHOD, \
        ),
        _, raise ValueError("Unknown LR scheduler: {}".format(name))
    )

_, raise ValueError("Unknown LR scheduler: {}".format(name))
^
SyntaxError: invalid syntax

@rochacbruno
Copy link

Maybe pampy needs a raise_error function to delegate error raising.

from pampy import match, _, raise_error

return match(x,
  1, "foo",
  2, "bar",
  _, raise_error(ValueError, "Message")
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants