pub struct RcTensorView { /* private fields */ }Implementations§
Source§impl RcTensorView
impl RcTensorView
Sourcepub fn elementwise<T, F>(
output: &mut Self,
inputs: &[&Self],
f: F,
) -> Result<()>
pub fn elementwise<T, F>( output: &mut Self, inputs: &[&Self], f: F, ) -> Result<()>
静态方法:对一组形状相同的视图执行逐元素运算。
output: 输出视图(可变)inputs: 输入视图列表,形状必须与输出相同f: 回调函数,参数为各输入视图在当前元素的值,返回输出值。
Source§impl RcTensorView
impl RcTensorView
Source§impl RcTensorView
impl RcTensorView
Source§impl RcTensorView
impl RcTensorView
Source§impl RcTensorView
impl RcTensorView
Trait Implementations§
Source§impl Add for RcTensorView
impl Add for RcTensorView
Source§impl AddAssign for RcTensorView
impl AddAssign for RcTensorView
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+= operation. Read moreSource§impl Clone for RcTensorView
impl Clone for RcTensorView
Source§fn clone(&self) -> RcTensorView
fn clone(&self) -> RcTensorView
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl TensorViewOps for RcTensorView
impl TensorViewOps for RcTensorView
Source§unsafe fn as_gpu_slice(&self) -> &CudaSlice<u8>
unsafe fn as_gpu_slice(&self) -> &CudaSlice<u8>
获取 GPU 切片(只读),视图偏移量由内核参数 strides 和 offset 处理。
Source§unsafe fn as_gpu_slice_mut(&mut self) -> &mut CudaSlice<u8>
unsafe fn as_gpu_slice_mut(&mut self) -> &mut CudaSlice<u8>
获取 GPU 切片(可变)。
type Handle = RcTensor
fn new(handle: RcTensor) -> Self
fn as_strided( &self, new_shape: Vec<usize>, new_strides: Vec<usize>, offset: usize, ) -> Self
fn is_contiguous(&self) -> bool
fn shape(&self) -> &[usize]
fn strides(&self) -> &[usize]
fn offset(&self) -> &usize
fn dtype(&self) -> DType
fn size(&self) -> usize
fn device(&self) -> Device
fn assign(&mut self, src: &Self) -> Result<()>
unsafe fn as_gpu_view(&self) -> CudaView<'_, u8>
unsafe fn as_gpu_view_mut(&self) -> CudaViewMut<'_, u8>
unsafe fn raw_data_ptr(&self) -> *mut u8
fn to(&self, out: &mut Self, target_device: Device) -> Result<()>
fn to_device(&self, target_device: Device) -> Result<Self>
fn broadcast_to(&self, target_shape: &[usize]) -> Result<Self>
fn transpose(&self, axes: &[usize]) -> Result<Self>
fn slice(&self, info: &SliceInfo) -> Result<Self>
fn concat_into(views: &[&Self], axis: usize, out: &mut Self) -> Result<()>
fn split_into( &self, sizes: &[usize], axis: usize, out_views: &mut [Self], ) -> Result<()>
fn concat(views: &[&Self], axis: usize) -> Result<Self>
fn split(&self, sizes: &[usize], axis: usize) -> Result<Vec<Self>>
fn strided_copy_to(&self, dst: &mut Self) -> Result<()>
fn contiguous_into(&self, out: &mut Self) -> Result<()>
fn contiguous(&self) -> Result<Self::Handle>
fn matmul_into(&self, other: &Self, out: &mut Self) -> Result<()>
fn matmul(&self, other: &Self) -> Result<Self>
fn fill<T: Pod + DTypeMapping>(&mut self, value: T) -> Result<()>
fn T(&self) -> Result<Self>
fn to_cpu(&self) -> Result<Self>
fn to_gpu(&self, device_id: usize) -> Result<Self>
fn num_bytes(&self) -> usize
Auto Trait Implementations§
impl Freeze for RcTensorView
impl !RefUnwindSafe for RcTensorView
impl !Send for RcTensorView
impl !Sync for RcTensorView
impl Unpin for RcTensorView
impl UnsafeUnpin for RcTensorView
impl !UnwindSafe for RcTensorView
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