Skip to content

feat: add gradient-check utility for autograd #158

Description

@ulises-jeremias

Standard AD libraries (PyTorch, JAX) provide gradcheck() comparing analytic backprop
against numerical finite differences. VTL has no such utility.

Task

Add autograd/gradcheck.v:

pub fn grad_check[T](ctx &Context[T], f fn() &Variable[T], eps f64) bool

Compares Variable.grad at each node against (f(x+eps)-f(x-eps))/(2*eps) with configurable tolerance.

File

  • New autograd/gradcheck.v

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions