We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
fsrs-rs-nodejs/src/lib.rs
Lines 35 to 42 in 343e9fd
ref https://napi.rs/cn/docs/concepts/typed-array
well, currently the code work, so don't touch it.
The text was updated successfully, but these errors were encountered:
@ishiko732
Sorry, something went wrong.
If using a TypedArray, I must wrap the parameter with Float32Array
+ pub fn new(parameters: Option<&[f32]>) -> Self { let params: Vec<f32> = match parameters { + Some(parameters) => parameters.into_iter().map(|p| *p as f32).collect(), None => DEFAULT_PARAMETERS.to_vec(), }; Self(Arc::new(Mutex::new( fsrs::FSRS::new(Some(¶ms)).unwrap(), ))) }
async function computeParametersWrapper(enableShortTerm) { // create FSRS instance and optimize const fsrs = new FSRS(null) const optimizedParameters = await fsrs.computeParameters( fsrsItems, enableShortTerm, progress.bind(null, enableShortTerm), 1000 /** 1s */, ) console.log(`[enableShortTerm=${enableShortTerm}]optimized parameters:`, optimizedParameters) - const model = new FSRS(optimizedParameters) // Error: Get TypedArray info failed + const model = new FSRS(Float32Array.from(optimizedParameters)) const metrics = model.evaluate(fsrsItems) console.log(`[enableShortTerm=${enableShortTerm}]metrics:`, metrics) }
No branches or pull requests
fsrs-rs-nodejs/src/lib.rs
Lines 35 to 42 in 343e9fd
ref https://napi.rs/cn/docs/concepts/typed-array
well, currently the code work, so don't touch it.
The text was updated successfully, but these errors were encountered: