TensorGpu

Type Alias TensorGpu 

Source
pub type TensorGpu<T, K> = Tensor<Gpu<K>, T>;

Aliased Type§

pub struct TensorGpu<T, K> { /* private fields */ }

Implementations§

Source§

impl<T: Scalar, K: Kind> TensorGpu<T, K>

Source

pub fn from_data_u8( context: &Context, shape: impl Into<Shape>, contents: &[u8], ) -> Result<Self, TensorError>

Source

pub fn back_in_place(&self) -> TensorCpu<T>

Source

pub async fn back(&self) -> TensorCpu<T>

Source§

impl<T: Scalar, K: Kind> TensorGpu<T, K>

Source

pub fn context(&self) -> &Context

Source

pub fn load(&self, host: &TensorCpu<T>) -> Result<(), TensorError>

Source

pub fn load_batch( &self, host: &TensorCpu<T>, batch: usize, ) -> Result<(), TensorError>

Source

pub fn destroy(self)

Source§

impl<T: Scalar> TensorGpu<T, Uniform>

Source

pub fn layout(&self, binding: u32) -> BindGroupLayoutEntry

Source§

impl<T: Scalar> TensorGpu<T, ReadWrite>

Source

pub fn meta_layout(&self, binding: u32) -> BindGroupLayoutEntry

Source

pub fn layout(&self, binding: u32, read_only: bool) -> BindGroupLayoutEntry

Source§

impl<T: Scalar> TensorGpu<T, ReadWrite>

Source

pub fn view( &self, x: impl TensorAxis, y: impl TensorAxis, z: impl TensorAxis, w: impl TensorAxis, ) -> Result<TensorGpuView<'_, T>, TensorError>

Create a view for the tensor.

Trait Implementations§

Source§

impl<T: Scalar> DeepClone for TensorGpu<T, ReadWrite>

Source§

fn deep_clone(&self) -> Self

Source§

impl<T: Scalar + Serialize, K: Kind> Serialize for TensorGpu<T, K>

Available on non-WebAssembly only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T: Scalar, K: Kind> TensorInitContext<T> for TensorGpu<T, K>

Source§

fn from_data<'a, S, D>( context: &Context, shape: S, data: D, ) -> Result<Self, TensorError>
where S: Into<Shape>, D: Into<Cow<'a, [T]>>,

Init the tensor with given shape and contents.
Source§

fn init(context: &Context, shape: impl Into<Shape>) -> Self

Init the tensor with given shape.
Source§

impl<T: Scalar> TensorInto<Tensor<Gpu<ReadWrite>, T>> for TensorGpu<T, ReadWrite>

Available on non-WebAssembly only.
Source§

fn to(self, context: &Context) -> Self

Source§

impl<T: Scalar, K: Kind> TensorReshape for TensorGpu<T, K>

Source§

impl<T: Scalar, K: Kind> TensorResource for TensorGpu<T, K>

Source§

fn resource_key(&self) -> ResourceKey

Retrieve the key identifying a resource.
Source§

fn meta_binding(&self) -> BindingResource<'_>

Binding for metadata of the tensor (shape, stride, etc.).
Source§

fn binding(&self) -> BindingResource<'_>

Binding for actual data of the tensor.
Source§

impl<T: Scalar, K: Kind> TensorShape for TensorGpu<T, K>

Source§

fn shape(&self) -> Shape

Get the shape of the tensor.
Source§

fn check_shape(&self, shape: impl Into<Shape>) -> Result<(), TensorError>

Check if the tensor’s shape is the same as what expected.
Source§

fn check_shape_any<S>(&self, shapes: &[S]) -> Result<(), TensorError>
where S: Into<Shape> + ToOwned<Owned = S>,

Check if the tensor’s shape matches any of the expected ones.