-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Milestone
Description
I am thinking of a better way of expressing arrayfire expressions in rust, however still needs some work on the design.
We can create macros describing an arrayfire expressions, like this:
let dims = af::Dim4::new(&[10, 10, 1, 1]);
let a = af::randu(dims, Aftype::F32)
let result = af::expression!(
|expr, err| println!("'{}' Calculation failure, error: {}", expr, err),
af::sin(1) / a + a);
let result = af::retry!(
3,
|expr, err| println!("'{}' Calcuation failure, error: {}", expr, err),
af::retry_expression!(af::sin(1) / a + a));
Most of the time I'm quite bored with a lot of and_then
appearing in my arrayfire-rust code, and creating a lot of disambiguation in expresstions.
However, the with the error appearing, generally people will:
- print the error, save the state and calculated results and let it panic. Then, let other daemon scripts restart the program.
- retry the calculation
Metadata
Metadata
Assignees
Labels
No labels