scan abstract values and tree prefix convention bug
See original GitHub issueRepro from @fehiepsi in the #772 thread:
import jax.numpy as np
from jax import jit, grad, lax
from jax.config import config; config.update("jax_platform_name", "cpu")
def f(init_s):
seasonality = init_s.shape[0]
def scan_fn(carry, t):
level, s, moving_sum = carry
season = s[0] * level ** 0.6
exp_val = level + 2 * level ** 0.5 + season
exp_val = np.clip(exp_val, a_min=0)
moving_sum = moving_sum + y[t] - np.where(t >= seasonality, y[t - seasonality], 0.)
#level_p = np.where(t >= seasonality, moving_sum / seasonality, y[t] - season)
#level = 0.2 * level_p + (1 - 0.2) * level
level = np.clip(level, a_min=0)
new_s = (0.3 * (y[t] - level) / season + (1 - 0.3)) * s[0]
s = np.concatenate([s[1:], new_s[None]], axis=0)
return (level, s, moving_sum), exp_val
y = np.ones(80)
level_init = y[0]
s_init = np.concatenate([init_s[1:], init_s[:1]], axis=0)
moving_sum = level_init
(last_level, last_s, moving_sum), exp_vals = lax.scan(
scan_fn, (level_init, s_init, moving_sum), np.arange(1, y.shape[0]))
return exp_vals.sum()
f(np.ones(38))
jit(f)(np.ones(38)) # Type Error
I think this is related to partial_eval._split_avals
not instantiating tuple-trees of units but instead truncating at the same tree prefix as the second_component
tree.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Java static code analysis: Abstract class names should comply ...
Unique rules to find Bugs, Vulnerabilities, Security Hotspots, and Code Smells in your JAVA ... Abstract class names should comply with a naming...
Read more >Bug listing with status RESOLVED with resolution OBSOLETE ...
Bug:1523 - "[IDEA] Offload work by distributing trivial ebuild ... sometimes crashes vdr while scanning" status:RESOLVED resolution:OBSOLETE severity:normal ...
Read more >Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >RFC 6020: YANG - A Data Modeling Language for the ...
RFC 6020 YANG October 2010 o list: An interior data node that may exist in multiple instances in the data tree. A list...
Read more >W3C XML Schema Definition Language (XSD) 1.1 Part 1
This chapter gives an overview of XML Schema Definition Language: Structures at the level of its abstract data model.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@fehiepsi I believe we have a branch that will close this. Hoping to merge sometime this week.
Here is a much smaller repro code that exercises this issue: