Struct ClBackend

Source
pub struct ClBackend { /* private fields */ }
Expand description

A structure of OpenCL backend.

Implementations§

Source§

impl ClBackend

Source

pub fn new() -> Result<ClBackend>

Creates an OpenCL backend for a first OpenCL platform and a first OpenCL device.

Source

pub fn new_with_context(context: Context) -> Result<ClBackend>

Creates an OpenCL backend with the context.

Trait Implementations§

Source§

impl Backend for ClBackend

Source§

fn name(&self) -> &'static str

Returns the backend name.
Source§

fn has_cublas(&self) -> bool

Returns true if the backend uses cuBLAS, otherwise false.
Source§

unsafe fn alloc(&self, n: usize) -> Result<BackendArray>

Allocates a backend array.
Source§

fn alloc_and_store_zeros(&self, n: usize) -> Result<BackendArray>

Allocates a backend array and stores zeros in the backend array.
Source§

fn alloc_and_store(&self, elems: &[f32]) -> Result<BackendArray>

Allocates a backend array and stores the elements in the backend array.
Source§

fn load(&self, a: &BackendArray, elems: &mut [f32]) -> Result<()>

Loads elements from the backenc array.
Source§

fn store(&self, a: &BackendArray, elems: &[f32]) -> Result<()>

Stores elements in the backend array.
Source§

fn copy(&self, a: &BackendArray, b: &BackendArray) -> Result<()>

Copies the a backend array to the b backend array.
Source§

fn transpose_a( &self, a: &BackendArray, b: &BackendArray, n: usize, m: usize, ) -> Result<()>

Transposes the a matrix and then the result is in the b matrix (C=AT).
Source§

fn add_a_b( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Adds the a matrix onto the b matrix and then the result is in the c matrix (C=A+B).
Source§

fn add_at_b( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Adds the transposed a matrix onto the b matrix and then the result is in the c matrix (C=AT+B).
Source§

fn add_a_bt( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Adds the a matrix onto the transposed b matrix and then the result is in the c matrix (C=A+BT).
Source§

fn add_at_bt( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Adds the transposed a matrix onto the transposed b matrix and then the result is in the c matrix (C=AT+BT).
Source§

fn sub_a_b( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Subtracts the b matrix from the a matrix and then the result is in the c matrix (C=A-B).
Source§

fn sub_at_b( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Subtracts the b matrix from the transposed a matrix and then the result is in the c matrix (C=AT-B).
Source§

fn sub_a_bt( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Subtracts the transposed b matrix from the a matrix and then the result is in the c matrix (C=A-BT).
Source§

fn sub_at_bt( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Subtracts the transposed b matrix from the transposed a matrix and then the result is in the c matrix (C=AT-BT).
Source§

fn mul_a_b( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, l: usize, ) -> Result<()>

Multiplies the a matrix by the b matrix and then the result is in the c matrix (C=A·B).
Source§

fn mul_at_b( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, l: usize, ) -> Result<()>

Multiplies the transposed a matrix by the b matrix and then the result is in the c matrix (C=AT·B).
Source§

fn mul_a_bt( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, l: usize, ) -> Result<()>

Multiplies the a matrix by the transposed b matrix and then the result is in the c matrix (C=A·BT).
Source§

fn mul_at_bt( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, l: usize, ) -> Result<()>

Multiplies the transposed a matrix by the transposed b matrix and then the result is in the c matrix (C=AT·BT).
Source§

fn mul_a_b_for_elems( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Multiplies the a matrix elements by the b matrix elements and then the result is in the c matrix (cij=aij·bij).
Source§

fn mul_at_b_for_elems( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Multiplies the transposed a matrix elements by the b matrix elements and saves the result to the c matrix (cij=aji·bij).
Source§

fn mul_a_bt_for_elems( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Multiplies the a matrix elements by the transposed b matrix elements and then the result is in the c matrix (cij=aij·bji).
Source§

fn mul_at_bt_for_elems( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Multiplies the transposed a matrix elements by the transposed b matrix elements and then the result is in the c matrix. (cij=aji·bji).
Source§

fn div_a_b_for_elems( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Divides the a matrix elements by the b matrix elements and then the result is in the c matrix (cij=aijbij).
Source§

fn div_at_b_for_elems( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Divides the transposed a matrix elements by the b matrix elements and then the result is in the c matrix (cij=ajibij).
Source§

fn div_a_bt_for_elems( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Divides the transposed a matrix elements by the b matrix elements and then the result is in the c matrix (cij=aijbji).
Source§

fn div_at_bt_for_elems( &self, a: &BackendArray, b: &BackendArray, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Divides the transposed a matrix elements by the transposed b matrix elements and then the result is in the c matrix (cij=ajibji).
Source§

fn add_a_b_for_scalar( &self, a: &BackendArray, b: f32, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Adds the a matrix onto the b scalar and then the result is in the c matrix (C=A+b).
Source§

fn add_at_b_for_scalar( &self, a: &BackendArray, b: f32, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Adds the transposed a matrix onto the b scalar and then the result is in the c matrix (C=AT+b).
Source§

fn sub_a_b_for_scalar( &self, a: &BackendArray, b: f32, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Subtracts the b scalar from the a matrix and then the result is in the c matrix. (C=A-b).
Source§

fn sub_at_b_for_scalar( &self, a: &BackendArray, b: f32, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Subtracts the b scalar from the transposed a matrix and then the result is in the c matrix (C=AT-b).
Source§

fn rsub_a_b_for_scalar( &self, a: &BackendArray, b: f32, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Subtracts the a matrix from the b scalar and then the result is in the c matrix (C=b-A).
Source§

fn rsub_at_b_for_scalar( &self, a: &BackendArray, b: f32, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Subtracts the transposed a matrix from the b scalar and then the result is in the c matrix (C=b-AT).
Source§

fn mul_a_b_for_scalar( &self, a: &BackendArray, b: f32, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Multiplies the a matrix by the b scalar and then the result is in the c matrix (C=A·b).
Source§

fn mul_at_b_for_scalar( &self, a: &BackendArray, b: f32, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Multiplies the transposed a matrix by the b scalar and then the result is in the c matrix (C=AT·b).
Source§

fn div_a_b_for_scalar( &self, a: &BackendArray, b: f32, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Divides the a matrix by the b scalar and then the result is in the c matrix (C=Ab).
Source§

fn div_at_b_for_scalar( &self, a: &BackendArray, b: f32, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Divides the transposed a matrix by the b scalar and then the result is in the c matrix (C=ATb).
Source§

fn rdiv_a_b_for_scalar( &self, a: &BackendArray, b: f32, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Divides the b scalar by the a matrix elements and then the result is in the c matrix (cij=baij).
Source§

fn rdiv_at_b_for_scalar( &self, a: &BackendArray, b: f32, c: &BackendArray, n: usize, m: usize, ) -> Result<()>

Divides the b scalar by the transposed a matrix elements and then the result is in the c matrix (cij=baji).
Source§

fn sigmoid_a( &self, a: &BackendArray, b: &BackendArray, n: usize, m: usize, ) -> Result<()>

Calculates sigmoid function for the a matrix adn the result is the b matrix (B=sigmoid(A)).
Source§

fn sigmoid_at( &self, a: &BackendArray, b: &BackendArray, n: usize, m: usize, ) -> Result<()>

Calculates sigmoid function for the transposed a matrix and then the result is in the b matrix (B=sigmoid(AT)).
Source§

fn tanh_a( &self, a: &BackendArray, b: &BackendArray, n: usize, m: usize, ) -> Result<()>

Calculates hyperbolic tangent function for the a matrix and then the result is in b matrix (B=tanh(A)).
Source§

fn tanh_at( &self, a: &BackendArray, b: &BackendArray, n: usize, m: usize, ) -> Result<()>

Calculates hyperbolic tangent function for the transposed a matrix and then the result is in the b matrix (B=tanh(AT)).
Source§

fn softmax_a( &self, a: &BackendArray, b: &BackendArray, n: usize, m: usize, ) -> Result<()>

Calculates softmax function for the a matrix and then the result is in the b matrix (B=softmax(A)).
Source§

fn softmax_at( &self, a: &BackendArray, b: &BackendArray, n: usize, m: usize, ) -> Result<()>

Calculates softmax function for the transposed a matrix and then the result is in the b matrix (B=softmax(AT)).
Source§

fn repeat_col_a( &self, a: &BackendArray, b: &BackendArray, n: usize, m: usize, ) -> Result<()>

Repeats the a vector as column (bij=ai).
Source§

fn repeat_row_a( &self, a: &BackendArray, b: &BackendArray, n: usize, m: usize, ) -> Result<()>

Repeats the a vector as row (bij=aj).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.