cubek-test-utils 0.2.0

CubeK: Test Utils
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use cubecl::{TestRuntime, std::tensor::TensorHandle, zspace::metadata::Metadata};

use crate::BaseInputSpec;

pub(crate) fn build_zeros(spec: BaseInputSpec) -> TensorHandle<TestRuntime> {
    let mut tensor = TensorHandle::zeros(&spec.client, spec.shape.clone(), spec.dtype);

    // This manipulation is only valid since all the data is the same
    *tensor.metadata = Metadata::new(tensor.shape(), spec.strides());

    tensor
}