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

Gradients for prod(x; dims) and cumprod(x), which take keywords & allow for zero entries #334

Closed
wants to merge 5 commits into from

Commits on Jul 23, 2018

  1. gradient for prod(x, dim) which allows for zero

    Michael Abbott committed Jul 23, 2018
    Configuration menu
    Copy the full SHA
    4f68bc1 View commit details
    Browse the repository at this point in the history

Commits on Sep 8, 2018

  1. faster ∇prod for vectors + correct ∇cumprod

    `prod(x::Array)` is much faster, and handles zeros correctly. 
    `prod(x::Array; dims)` now uses a keyword, and just uses `mapslices(∇prod, x; dims)`. 
    `prod(x::AbstractArray)` falls back to earlier `circshift...` methods. 
    It would be easy to make `prod(f::Function, x::Array)` use fast `∇prod` but I didn't see a neat way to fall back, so left it alone. 
    
    `cumprod(x)` now has a gradient; previously this gave Array{TrackedReal}. 
    `cumprod(x; dims::Int)` works by something like `mapslices(∇cumprod, x, p, Δ; dims)` which I cooked up. 
    (This was the case I originally wanted all this for!)
    mcabbott committed Sep 8, 2018
    Configuration menu
    Copy the full SHA
    64648dd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3b5a42c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    aa34a79 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4d57463 View commit details
    Browse the repository at this point in the history