pub struct OpenCL(/* private fields */);
Expand description
OpenCL backend
Implementations§
Source§impl OpenCL
impl OpenCL
Sourcepub fn tensor<'a>(&'a self, data: impl IntoTensor<&'a Self>) -> Tensor<&'a Self>
pub fn tensor<'a>(&'a self, data: impl IntoTensor<&'a Self>) -> Tensor<&'a Self>
Create new tensor
Sourcepub fn randn(&self, shape: impl Into<Shape>, dtype: DType) -> Tensor<&Self>
pub fn randn(&self, shape: impl Into<Shape>, dtype: DType) -> Tensor<&Self>
Create new tensor using values from standard normal distribution
Sourcepub fn uniform(
&self,
shape: impl Into<Shape>,
range: Range<impl Scalar>,
) -> Tensor<&Self>
pub fn uniform( &self, shape: impl Into<Shape>, range: Range<impl Scalar>, ) -> Tensor<&Self>
Create new tensor using values from uniform distribution
Sourcepub fn full(&self, shape: impl Into<Shape>, value: impl Scalar) -> Tensor<&Self>
pub fn full(&self, shape: impl Into<Shape>, value: impl Scalar) -> Tensor<&Self>
Create new tensor by repeating single value
Sourcepub fn zeros(&self, shape: impl Into<Shape>, dtype: DType) -> Tensor<&Self>
pub fn zeros(&self, shape: impl Into<Shape>, dtype: DType) -> Tensor<&Self>
Create new tensor by repeating zeroes
Sourcepub fn ones(&self, shape: impl Into<Shape>, dtype: DType) -> Tensor<&Self>
pub fn ones(&self, shape: impl Into<Shape>, dtype: DType) -> Tensor<&Self>
Create new tensor by repeating ones
Sourcepub fn load(
&self,
path: impl AsRef<Path>,
) -> Result<Vec<Tensor<&OpenCL>>, ZyxError>
pub fn load( &self, path: impl AsRef<Path>, ) -> Result<Vec<Tensor<&OpenCL>>, ZyxError>
Load tensors from disk.
Sourcepub fn plot_graph<'a, B: Backend + 'a>(
&self,
tensors: impl IntoIterator<Item = &'a Tensor<B>>,
) -> String
pub fn plot_graph<'a, B: Backend + 'a>( &self, tensors: impl IntoIterator<Item = &'a Tensor<B>>, ) -> String
Create graph of operations between tensors in dot format for visualization
Trait Implementations§
Source§impl Backend for &OpenCL
impl Backend for &OpenCL
Source§fn plot_graph<'a, B: Backend + 'a>(
self,
tensors: impl IntoIterator<Item = &'a Tensor<B>>,
) -> String
fn plot_graph<'a, B: Backend + 'a>( self, tensors: impl IntoIterator<Item = &'a Tensor<B>>, ) -> String
Create graph of operations between tensors in dot format for visualization
Source§fn randn(
self,
shape: impl Into<Shape>,
dtype: DType,
) -> Result<Tensor<Self>, ZyxError>
fn randn( self, shape: impl Into<Shape>, dtype: DType, ) -> Result<Tensor<Self>, ZyxError>
Create new tensor using values from standard normal distribution
Source§fn uniform(
self,
shape: impl Into<Shape>,
range: Range<impl Scalar>,
) -> Result<Tensor<Self>, ZyxError>
fn uniform( self, shape: impl Into<Shape>, range: Range<impl Scalar>, ) -> Result<Tensor<Self>, ZyxError>
Create new tensor using values from uniform distribution
Source§fn backward(
self,
x: Id,
sources: &BTreeSet<Id>,
) -> Result<BTreeMap<Id, Id>, ZyxError>
fn backward( self, x: Id, sources: &BTreeSet<Id>, ) -> Result<BTreeMap<Id, Id>, ZyxError>
Calculate derivatives of x w.r.t. sources.
Returns map source id -> gradient id
Source§fn load<T: Scalar>(self, x: Id) -> Result<Vec<T>, ZyxError>
fn load<T: Scalar>(self, x: Id) -> Result<Vec<T>, ZyxError>
Returns iterator over data stored in backend
Source§fn store<T: Scalar, IT>(self, iter: IT) -> Result<Id, ZyxError>
fn store<T: Scalar, IT>(self, iter: IT) -> Result<Id, ZyxError>
Store iterator into backend as tensor
Source§fn tensor(self, data: impl IntoTensor<Self>) -> Result<Tensor<Self>, ZyxError>
fn tensor(self, data: impl IntoTensor<Self>) -> Result<Tensor<Self>, ZyxError>
Create new tensor
Source§fn full(
self,
shape: impl Into<Shape>,
value: impl Scalar,
) -> Result<Tensor<Self>, ZyxError>
fn full( self, shape: impl Into<Shape>, value: impl Scalar, ) -> Result<Tensor<Self>, ZyxError>
Create new tensor by repeating single value
Source§fn zeros(
self,
shape: impl Into<Shape>,
dtype: DType,
) -> Result<Tensor<Self>, ZyxError>
fn zeros( self, shape: impl Into<Shape>, dtype: DType, ) -> Result<Tensor<Self>, ZyxError>
Create new tensor by repeating zeroes
Auto Trait Implementations§
impl !Freeze for OpenCL
impl !RefUnwindSafe for OpenCL
impl !Send for OpenCL
impl !Sync for OpenCL
impl Unpin for OpenCL
impl UnwindSafe for OpenCL
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more