Giter Club home page Giter Club logo

Comments (2)

xffxff avatar xffxff commented on August 28, 2024

@enomado I believe the panic is the expected behavior of Salsa, as mentioned in issue #407. The issue lies in the code p.md(&db) within the loop, which continues to use a tracked struct after altering the inputs using a.set_md(&mut db).to(vec![i as f64]). To fix this, you should call m_merge again to get the newest tracked struct.

let a = MyVal::new(&db, vec![1.0]);
let b = MyVal::new(&db, vec![2.0]);

let p = m_merge(&db, a, b);

for i in 0..10 {
    a.set_md(&mut db).to(vec![i as f64]);
    let p = m_merge(&db, a, b);
    dbg!(p.md(&db));
}

However, I think that the error message needs improvement to avoid confusion. A panic message like "accessing a field of a tracked struct MyVal from an older revision" would be better.

from salsa.

enomado avatar enomado commented on August 28, 2024

@xffxff thanks! I thought tracked structure can store whole computation chain at its own. I think it must be covered in documentation. just like

dont expect tracked struct can recalculate itself without calling whole chain

it could clarify a lot :)

Btw, please, tell where I wrong. I want generalize input structs and tracked structs

from salsa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.