pub struct ArcTensor(pub Arc<ReentrantMutex<RefCell<Tensor>>>);Expand description
原子引用计数(线程安全)张量句柄。
Tuple Fields§
§0: Arc<ReentrantMutex<RefCell<Tensor>>>Implementations§
Source§impl ArcTensor
impl ArcTensor
Sourcepub fn lock(&self) -> ReentrantMutexGuard<'_, RefCell<Tensor>>
pub fn lock(&self) -> ReentrantMutexGuard<'_, RefCell<Tensor>>
获取内部数据的互斥锁守卫
Sourcepub fn from_tensor(t: Tensor) -> Self
pub fn from_tensor(t: Tensor) -> Self
从 Tensor 创建新的 ArcTensor
Sourcepub fn into_inner(self) -> Arc<ReentrantMutex<RefCell<Tensor>>> ⓘ
pub fn into_inner(self) -> Arc<ReentrantMutex<RefCell<Tensor>>> ⓘ
获取内部句柄的克隆
Source§impl ArcTensor
impl ArcTensor
Sourcepub fn as_view(&self) -> ArcTensorView
pub fn as_view(&self) -> ArcTensorView
获取内部句柄的视图
pub fn broadcast_to(&self, target_shape: &[usize]) -> Result<ArcTensorView>
pub fn transpose(&self, axes: &[usize]) -> Result<ArcTensorView>
pub fn T(&self) -> Result<ArcTensorView>
Trait Implementations§
Source§impl AddAssign for ArcTensor
impl AddAssign for ArcTensor
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+= operation. Read moreAuto Trait Implementations§
impl Freeze for ArcTensor
impl !RefUnwindSafe for ArcTensor
impl Send for ArcTensor
impl Sync for ArcTensor
impl Unpin for ArcTensor
impl UnsafeUnpin for ArcTensor
impl !UnwindSafe for ArcTensor
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