Skip to content

StepDecay and OneCycle accept values that divide by zero or underflow #28

Description

@CanReader

Two gaps in src/optim/schedule.rs:

  • StepDecay::new(base, 0, gamma) then panics with "attempt to divide by zero" on
    the first lr_at (schedule.rs:51). Nothing validates every in the
    constructor.
  • OneCycle with warmup_fraction > 1.0 makes warmup > total, so
    self.total - warmup underflows usize (schedule.rs:140). Panic in debug,
    nonsense remaining in release, since the release profile has overflow checks
    off.

Every other builder in optim/ already asserts its range (Adadelta::rho,
RMSprop::alpha, Lookahead::new), these two just got missed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Hygienearea:optimbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions