diff --git a/examples/custom-ops/examples/custom-ops.rs b/examples/custom-ops/examples/custom-ops.rs index 2f7c4cb..f92c064 100644 --- a/examples/custom-ops/examples/custom-ops.rs +++ b/examples/custom-ops/examples/custom-ops.rs @@ -79,7 +79,13 @@ fn main() -> ort::Result<()> { .commit_from_file("tests/data/custom_op_test.onnx")?; let allocator = session.allocator(); - let value1 = Tensor::::new(allocator, [3, 5])?; + let mut value1 = Tensor::::new(allocator, [3, 5])?; + { + let (_, data) = value1.extract_raw_tensor_mut(); + for datum in data { + *datum = 0.; + } + } let mut value2 = Tensor::::new(allocator, [3, 5])?; { let (_, data) = value2.extract_raw_tensor_mut(); diff --git a/src/operator/tests.rs b/src/operator/tests.rs index 88d2e10..1581927 100644 --- a/src/operator/tests.rs +++ b/src/operator/tests.rs @@ -82,7 +82,13 @@ fn test_custom_ops() -> crate::Result<()> { .commit_from_file("tests/data/custom_op_test.onnx")?; let allocator = session.allocator(); - let value1 = Tensor::::new(allocator, [3, 5])?; + let mut value1 = Tensor::::new(allocator, [3, 5])?; + { + let (_, data) = value1.extract_raw_tensor_mut(); + for datum in data { + *datum = 0.; + } + } let mut value2 = Tensor::::new(allocator, [3, 5])?; { let (_, data) = value2.extract_raw_tensor_mut();