⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content
Discussion options

You must be logged in to vote

Array doesn't have fmt implemented in the library code. Hence, I was suggesting you could do it or you can just using existing methods to print the relevant info.

pub struct SomeStruct {
    pub data: arrayfire::Array<f32>,
    pub handle: i32,
}

impl std::fmt::Display for SomeStruct {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        af_print!("entire array:", self.data);
        write!(f, "Handle value: {}", self.handle)
    }
}

fn main() {
    let s = SomeStruct{handle: 0, data: arrayfire::constant(0f32, Dim4::new(&[5, 5, 1, 1]))};
    println!("{}", s);
}

The associated output looks like below

entire array:
[5 5 1 1]
    0.0000     0.0000     0.0000     0.…

Replies: 7 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by 9prady9
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants