Skip to main content

gpu_elementwise

Function gpu_elementwise 

Source
pub fn gpu_elementwise(data: Vec<f64>, op: &str) -> PyResult<Vec<f64>>
Expand description

Apply an element-wise activation to every element of data.

Supported operations: "exp", "log", "sqrt", "relu", "sigmoid", "tanh", "abs", "square".

For "log" of non-positive values the result is -∞; for "sqrt" of negative values the result is NaN. These match NumPy conventions.

§Errors

Returns PyValueError if op is not one of the supported strings.