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

Fix JAX 0.4.28 regression in SciPy logsumexp scale propagation. #108

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

balancap
Copy link
Contributor

@balancap balancap commented Jun 10, 2024

New JAX version introducing an addtional max operation with -inf.
Needs proper handling of this special value in scalify.

@balancap
Copy link
Contributor Author

balancap commented Jun 10, 2024

Issue due to change in jaxpr: c:f32[] = max -inf b added since JAX 0.4.28

JAX 0.4.28

{ lambda ; a:f32[10]. let
    b:f32[] = reduce_max[axes=(0,)] a
    c:f32[] = max -inf b
    d:bool[] = is_finite c
    e:f32[] = select_n d 0.0 c
    f:f32[] = stop_gradient e
    g:f32[1] = broadcast_in_dim[broadcast_dimensions=() shape=(1,)] f
    h:f32[10] = sub a g
    i:f32[10] = exp h
    j:f32[] = reduce_sum[axes=(0,)] i
    _:f32[] = sign j
    k:f32[] = abs j
    l:f32[] = log k
    m:f32[] = add l f
  in (m,) }

JAX 0.4.26

{ lambda ; a:f32[10]. let
    b:f32[] = reduce_max[axes=(0,)] a
    c:bool[] = is_finite b
    d:f32[] = select_n c 0.0 b
    e:f32[] = stop_gradient d
    f:f32[1] = broadcast_in_dim[broadcast_dimensions=() shape=(1,)] e
    g:f32[10] = sub a f
    h:f32[10] = exp g
    i:f32[] = reduce_sum[axes=(0,)] h
    _:f32[] = sign i
    j:f32[] = abs i
    k:f32[] = log j
    l:f32[] = add k e
  in (l,) }

@balancap balancap self-assigned this Jun 11, 2024
@balancap balancap added bug Something isn't working labels Jun 11, 2024
New JAX version introducing an addtional `max` operation with `-inf`.
Needs proper handling of this special value in scalify.
@balancap balancap merged commit 8d94ca0 into main Jun 12, 2024
2 checks passed
@balancap balancap deleted the fix-scipy-jax-0-4-28-issue branch June 12, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant