ndrs 0.5.0

A tensor library with GPU support
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#[macro_export]
macro_rules! impl_fill {
    ($view_type:ident, $handle:ty) => {
        fn fill<T: bytemuck::Pod + crate::dtype::DTypeMapping>(&mut self, value: T) -> Result<()> {
            match self.device() {
                Device::Cpu => {
                    // 调用 CPU 填充实现(假设有 Self::fill_cpu 静态方法)
                    Self::fill_cpu(self, value)
                }
                Device::Cuda(_) => {
                    // 调用 GPU 填充实现(假设有 Self::fill_cuda 静态方法)
                    Self::fill_cuda(self, value)
                }
            }
        }
    };
}