| 468 | } |
| 469 | |
| 470 | fn custom_reduce_vec_helper( |
| 471 | arrays: Vec<TypedValue>, |
| 472 | combine: impl Fn(Vec<Node>, Vec<Node>) -> Result<Vec<Node>>, |
| 473 | ) -> Result<Vec<Value>> { |
| 474 | let c = simple_context(|g| { |
| 475 | let inputs = arrays |
| 476 | .iter() |
| 477 | .map(|array| g.input(array.t.clone())) |
| 478 | .collect::<Result<_>>()?; |
| 479 | g.create_tuple(custom_reduce_vec(inputs, combine)?) |
| 480 | })?; |
| 481 | let c = run_instantiation_pass(c)?.context; |
| 482 | let inputs = arrays.into_iter().map(|array| array.value).collect(); |
| 483 | let outputs = random_evaluate(c.get_main_graph()?, inputs)?; |
| 484 | outputs.to_vector() |
| 485 | } |
| 486 | |
| 487 | #[test] |
| 488 | fn test_custom_reduce_vec_sum_and_multiply_rows() -> Result<()> { |