numr 0.5.1

High-performance numerical computing with multi-backend GPU acceleration (CPU/CUDA/WebGPU)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Validation helpers for special mathematical functions.

use crate::dtype::DType;
use crate::error::{Error, Result};

/// Validate that dtype is suitable for special functions.
pub fn validate_special_dtype(dtype: DType) -> Result<()> {
    match dtype {
        DType::F32 | DType::F64 | DType::F16 | DType::BF16 | DType::FP8E4M3 | DType::FP8E5M2 => {
            Ok(())
        }
        _ => Err(Error::UnsupportedDType {
            dtype,
            op: "special function",
        }),
    }
}