mirror of
https://github.com/huggingface/candle.git
synced 2025-06-20 04:00:28 +00:00
onnx: implement Size op (#2316)
This commit is contained in:
@ -643,6 +643,13 @@ fn simple_eval_(
|
||||
let dims = Tensor::from_vec(dims, xs.rank(), xs.device())?;
|
||||
values.insert(node.output[0].clone(), dims);
|
||||
}
|
||||
// https://github.com/onnx/onnx/blob/main/docs/Operators.md#Size
|
||||
"Size" => {
|
||||
let data = get(&node.input[0])?;
|
||||
let size: usize = data.dims().iter().product();
|
||||
let output = Tensor::from_slice(&[size as i64], (), data.device())?;
|
||||
values.insert(node.output[0].clone(), output);
|
||||
}
|
||||
// https://github.com/onnx/onnx/blob/main/docs/Operators.md#Sqrt
|
||||
"Sqrt" => {
|
||||
let xs = get(&node.input[0])?;
|
||||
|
Reference in New Issue
Block a user