pub struct Tensor<T: Float> {
pub data: ArrayD<T>,
pub device: Device,
pub requires_grad: bool,
}Expand description
A multi-dimensional array that supports automatic differentiation. 自動微分をサポートする多次元配列
Fields§
§data: ArrayD<T>The underlying n-dimensional array data 基底のn次元配列データ
device: DeviceDevice where tensor is stored テンソルが保存されているデバイス
requires_grad: boolWhether tensor requires gradient computation テンソルが勾配計算を必要とするか
Implementations§
Source§impl<T: Float + FromPrimitive + ScalarOperand + Send + Sync + 'static> Tensor<T>
impl<T: Float + FromPrimitive + ScalarOperand + Send + Sync + 'static> Tensor<T>
Sourcepub fn relu_fallback(&self) -> RusTorchResult<Tensor<T>>
pub fn relu_fallback(&self) -> RusTorchResult<Tensor<T>>
CPU fallback ReLU implementation CPU フォールバック ReLU 実装
Sourcepub fn sigmoid_fallback(&self) -> RusTorchResult<Tensor<T>>
pub fn sigmoid_fallback(&self) -> RusTorchResult<Tensor<T>>
CPU fallback Sigmoid implementation CPU フォールバック Sigmoid 実装
Sourcepub fn softmax_fallback(&self, dim: isize) -> RusTorchResult<Tensor<T>>
pub fn softmax_fallback(&self, dim: isize) -> RusTorchResult<Tensor<T>>
CPU fallback Softmax implementation CPU フォールバック Softmax 実装
Sourcepub fn gelu_fallback(&self) -> RusTorchResult<Tensor<T>>
pub fn gelu_fallback(&self) -> RusTorchResult<Tensor<T>>
CPU fallback GELU implementation CPU フォールバック GELU 実装
Sourcepub fn leaky_relu_fallback(
&self,
negative_slope: f64,
) -> RusTorchResult<Tensor<T>>
pub fn leaky_relu_fallback( &self, negative_slope: f64, ) -> RusTorchResult<Tensor<T>>
CPU fallback Leaky ReLU implementation CPU フォールバック Leaky ReLU 実装
Sourcepub fn elu_fallback(&self, alpha: f64) -> RusTorchResult<Tensor<T>>
pub fn elu_fallback(&self, alpha: f64) -> RusTorchResult<Tensor<T>>
CPU fallback ELU implementation CPU フォールバック ELU 実装
Sourcepub fn swish_fallback(&self) -> RusTorchResult<Tensor<T>>
pub fn swish_fallback(&self) -> RusTorchResult<Tensor<T>>
CPU fallback Swish implementation CPU フォールバック Swish 実装
pub fn relu_metal(&self) -> RusTorchResult<Tensor<T>>
pub fn sigmoid_metal(&self) -> RusTorchResult<Tensor<T>>
pub fn tanh_metal(&self) -> RusTorchResult<Tensor<T>>
pub fn gelu_metal(&self) -> RusTorchResult<Tensor<T>>
pub fn leaky_relu_metal( &self, _negative_slope: f64, ) -> RusTorchResult<Tensor<T>>
pub fn elu_metal(&self, _alpha: f64) -> RusTorchResult<Tensor<T>>
pub fn swish_metal(&self) -> RusTorchResult<Tensor<T>>
Source§impl<T: Float + FromPrimitive + ScalarOperand + Send + Sync + 'static> Tensor<T>
impl<T: Float + FromPrimitive + ScalarOperand + Send + Sync + 'static> Tensor<T>
Sourcepub fn conv_transpose2d_fallback(
&self,
_kernel: &Self,
_params: &ConvolutionParams,
) -> RusTorchResult<Tensor<T>>
pub fn conv_transpose2d_fallback( &self, _kernel: &Self, _params: &ConvolutionParams, ) -> RusTorchResult<Tensor<T>>
CPU fallback transpose convolution implementation CPU フォールバック転置畳み込み実装
Sourcepub fn depthwise_conv2d_fallback(
&self,
_kernel: &Self,
_params: &ConvolutionParams,
) -> RusTorchResult<Tensor<T>>
pub fn depthwise_conv2d_fallback( &self, _kernel: &Self, _params: &ConvolutionParams, ) -> RusTorchResult<Tensor<T>>
CPU fallback depthwise convolution implementation CPU フォールバック深度分離畳み込み実装
Sourcepub fn grouped_conv2d_fallback(
&self,
_kernel: &Self,
_params: &ConvolutionParams,
_groups: usize,
) -> RusTorchResult<Tensor<T>>
pub fn grouped_conv2d_fallback( &self, _kernel: &Self, _params: &ConvolutionParams, _groups: usize, ) -> RusTorchResult<Tensor<T>>
CPU fallback grouped convolution implementation CPU フォールバック グループ畳み込み実装
Sourcepub fn conv3d_fallback(
&self,
_kernel: &Self,
_params: &ConvolutionParams,
) -> RusTorchResult<Tensor<T>>
pub fn conv3d_fallback( &self, _kernel: &Self, _params: &ConvolutionParams, ) -> RusTorchResult<Tensor<T>>
CPU fallback 3D convolution implementation CPU フォールバック 3D 畳み込み実装
Source§impl<T: Float + 'static> Tensor<T>
impl<T: Float + 'static> Tensor<T>
Sourcepub fn new_with_options(
data: ArrayD<T>,
device: Device,
requires_grad: bool,
) -> Self
pub fn new_with_options( data: ArrayD<T>, device: Device, requires_grad: bool, ) -> Self
Creates a new tensor with device and gradient settings デバイスと勾配設定付きで新しいテンソルを作成
Sourcepub fn from_vec(data: Vec<T>, shape: Vec<usize>) -> Self
pub fn from_vec(data: Vec<T>, shape: Vec<usize>) -> Self
Creates a tensor from a vector and shape. ベクトルと形状からテンソルを作成します。
Sourcepub fn from_vec_with_options(
data: Vec<T>,
shape: Vec<usize>,
device: Device,
requires_grad: bool,
) -> Self
pub fn from_vec_with_options( data: Vec<T>, shape: Vec<usize>, device: Device, requires_grad: bool, ) -> Self
Creates a tensor from a vector and shape with device and gradient settings デバイスと勾配設定付きでベクトルと形状からテンソルを作成
Sourcepub fn try_from_vec(data: Vec<T>, shape: Vec<usize>) -> RusTorchResult<Self>
pub fn try_from_vec(data: Vec<T>, shape: Vec<usize>) -> RusTorchResult<Self>
Creates a tensor from a vector and shape with error handling. エラーハンドリング付きでベクトルと形状からテンソルを作成します。
Sourcepub fn as_ptr(&self) -> *const T
pub fn as_ptr(&self) -> *const T
Get pointer address for unique identification ユニーク識別用のポインターアドレスを取得
Sourcepub fn copy_from(&self, other: &Tensor<T>)
pub fn copy_from(&self, other: &Tensor<T>)
Copy data from another tensor (unsafe internal implementation) 別のテンソルからデータをコピー(unsafe内部実装)
Sourcepub fn to_device(&self, _device: Arc<dyn GpuDevice>) -> Self
pub fn to_device(&self, _device: Arc<dyn GpuDevice>) -> Self
Convert tensor to different device (mock implementation) テンソルを別のデバイスに変換(モック実装)
Sourcepub fn auto_device(&self) -> Self
pub fn auto_device(&self) -> Self
Automatically select the best device for this tensor operation このテンソル操作に最適なデバイスを自動選択
Sourcepub fn try_to_gpu(&self) -> RusTorchResult<Self>
pub fn try_to_gpu(&self) -> RusTorchResult<Self>
Try to move tensor to GPU with error handling エラーハンドリング付きでテンソルをGPUに移動を試行
Sourcepub fn is_gpu_available(&self) -> bool
pub fn is_gpu_available(&self) -> bool
Check if GPU is available for this tensor このテンソルでGPUが利用可能かチェック
Sourcepub fn device(&self) -> Device
pub fn device(&self) -> Device
Get the device where this tensor is stored このテンソルが保存されているデバイスを取得
Sourcepub fn requires_grad(&self) -> bool
pub fn requires_grad(&self) -> bool
Check if tensor requires gradient computation テンソルが勾配計算を必要とするかチェック
Sourcepub fn set_requires_grad(&mut self, requires_grad: bool) -> &mut Self
pub fn set_requires_grad(&mut self, requires_grad: bool) -> &mut Self
Set whether tensor requires gradient computation テンソルが勾配計算を必要とするかを設定
Sourcepub fn with_device(&self, device: Device) -> Self
pub fn with_device(&self, device: Device) -> Self
Move tensor to specified device type テンソルを指定デバイスタイプに移動
Sourcepub fn device_type(&self) -> String
pub fn device_type(&self) -> String
Get the current device type for this tensor このテンソルの現在のデバイスタイプを取得
Sourcepub fn zeros_on_device(shape: &[usize], device: Device) -> Self
pub fn zeros_on_device(shape: &[usize], device: Device) -> Self
Creates a tensor filled with zeros on specified device 指定デバイス上でゼロで満たされたテンソルを作成
Sourcepub fn try_zeros(shape: &[usize]) -> RusTorchResult<Self>
pub fn try_zeros(shape: &[usize]) -> RusTorchResult<Self>
Creates a tensor filled with zeros with error handling. エラーハンドリング付きでゼロで満たされたテンソルを作成します。
Sourcepub fn ones_on_device(shape: &[usize], device: Device) -> Self
pub fn ones_on_device(shape: &[usize], device: Device) -> Self
Creates a tensor filled with ones on specified device 指定デバイス上で1で満たされたテンソルを作成
Sourcepub fn try_ones(shape: &[usize]) -> RusTorchResult<Self>
pub fn try_ones(shape: &[usize]) -> RusTorchResult<Self>
Creates a tensor filled with ones with error handling. エラーハンドリング付きで1で満たされたテンソルを作成します。
Sourcepub fn zeros_auto(shape: &[usize]) -> Self
pub fn zeros_auto(shape: &[usize]) -> Self
Creates a tensor filled with zeros with automatic device selection 自動デバイス選択付きでゼロで満たされたテンソルを作成
Sourcepub fn ones_auto(shape: &[usize]) -> Self
pub fn ones_auto(shape: &[usize]) -> Self
Creates a tensor filled with ones with automatic device selection 自動デバイス選択付きで1で満たされたテンソルを作成
Sourcepub fn from_vec_auto(data: Vec<T>, shape: Vec<usize>) -> Self
pub fn from_vec_auto(data: Vec<T>, shape: Vec<usize>) -> Self
Creates a tensor from vector with automatic device selection 自動デバイス選択付きでベクトルからテンソルを作成
Sourcepub fn from_scalar(value: T) -> Self
pub fn from_scalar(value: T) -> Self
Create a scalar tensor from a single value 単一の値からスカラーテンソルを作成
Sourcepub fn from_ndarray(array: ArrayD<T>) -> Self
pub fn from_ndarray(array: ArrayD<T>) -> Self
Create tensor from ndarray ndarrayからテンソルを作成
Sourcepub fn full(shape: &[usize], value: T) -> Self
pub fn full(shape: &[usize], value: T) -> Self
Creates a tensor filled with a specific value. 指定された値で満たされたテンソルを作成します。
Sourcepub fn size(&self) -> Vec<usize>
pub fn size(&self) -> Vec<usize>
Returns the size of the tensor (total number of elements). テンソルのサイズ(要素の総数)を返します。
Sourcepub fn resolve_dim(&self, dim: isize) -> Result<usize, String>
pub fn resolve_dim(&self, dim: isize) -> Result<usize, String>
Resolve a dimension index (supports negative indexing) 次元インデックスを解決(負のインデックスをサポート)
Sourcepub fn reshape(&self, new_shape: &[usize]) -> RusTorchResult<Self>where
T: ScalarOperand + FromPrimitive,
pub fn reshape(&self, new_shape: &[usize]) -> RusTorchResult<Self>where
T: ScalarOperand + FromPrimitive,
Reshapes the tensor to the given shape (new v2 implementation). テンソルを指定された形状に変形します。(新v2実装)
Sourcepub fn try_view(&self, shape: &[usize]) -> RusTorchResult<Self>
pub fn try_view(&self, shape: &[usize]) -> RusTorchResult<Self>
Creates a view into the tensor. テンソルのビューを作成します。 Creates a view into the tensor with proper error handling. 適切なエラーハンドリング付きでテンソルのビューを作成します。
Sourcepub fn as_slice(&self) -> Option<&[T]>
pub fn as_slice(&self) -> Option<&[T]>
Flattens the tensor to 1D. テンソルを1次元に平坦化します。 Returns a reference to the underlying data as a slice. 基になるデータへのスライス参照を返します。
Sourcepub fn as_slice_mut(&mut self) -> Option<&mut [T]>
pub fn as_slice_mut(&mut self) -> Option<&mut [T]>
Returns a mutable reference to the underlying data as a slice. 基になるデータへの可変スライス参照を返します。
Sourcepub fn as_array(&self) -> &ArrayD<T>
pub fn as_array(&self) -> &ArrayD<T>
Returns a reference to the underlying ndarray. 基になるndarrayへの参照を返します。
Sourcepub fn as_array_mut(&mut self) -> &mut ArrayD<T>
pub fn as_array_mut(&mut self) -> &mut ArrayD<T>
Returns a mutable reference to the underlying ndarray. 基になるndarrayへの可変参照を返します。
Sourcepub fn get(&self, index: &[usize]) -> Option<T>
pub fn get(&self, index: &[usize]) -> Option<T>
Gets an element at the specified index. 指定されたインデックスの要素を取得します。
Sourcepub fn set(&mut self, index: &[usize], value: T) -> Result<(), String>
pub fn set(&mut self, index: &[usize], value: T) -> Result<(), String>
Sets an element at the specified index. 指定されたインデックスの要素を設定します。
Sourcepub fn where_(
&self,
condition: &ArrayD<bool>,
other: &Tensor<T>,
) -> RusTorchResult<Tensor<T>>
pub fn where_( &self, condition: &ArrayD<bool>, other: &Tensor<T>, ) -> RusTorchResult<Tensor<T>>
Select elements from self or other based on condition 条件に基づいてselfまたはotherから要素を選択
Sourcepub fn masked_select(&self, mask: &ArrayD<bool>) -> RusTorchResult<Tensor<T>>
pub fn masked_select(&self, mask: &ArrayD<bool>) -> RusTorchResult<Tensor<T>>
Select elements where mask is true マスクがtrueの位置の要素を選択
Sourcepub fn masked_fill(
&self,
mask: &ArrayD<bool>,
value: T,
) -> RusTorchResult<Tensor<T>>
pub fn masked_fill( &self, mask: &ArrayD<bool>, value: T, ) -> RusTorchResult<Tensor<T>>
Fill tensor elements where mask is true with value マスクがtrueの位置の要素を値で埋める
Sourcepub fn gather(
&self,
dim: usize,
index: &ArrayD<i64>,
) -> RusTorchResult<Tensor<T>>
pub fn gather( &self, dim: usize, index: &ArrayD<i64>, ) -> RusTorchResult<Tensor<T>>
Gather values along an axis 軸に沿って値を収集
Sourcepub fn scatter(
&self,
dim: usize,
index: &ArrayD<i64>,
src: &Tensor<T>,
) -> RusTorchResult<Tensor<T>>
pub fn scatter( &self, dim: usize, index: &ArrayD<i64>, src: &Tensor<T>, ) -> RusTorchResult<Tensor<T>>
Scatter values along an axis 軸に沿って値を散布
Sourcepub fn index_select(
&self,
dim: usize,
index: &ArrayD<i64>,
) -> RusTorchResult<Tensor<T>>
pub fn index_select( &self, dim: usize, index: &ArrayD<i64>, ) -> RusTorchResult<Tensor<T>>
Select values along an axis using index インデックスを使って軸に沿って値を選択
Sourcepub fn topk_util(
&self,
k: usize,
dim: usize,
largest: bool,
sorted: bool,
) -> RusTorchResult<(Tensor<T>, ArrayD<i64>)>
pub fn topk_util( &self, k: usize, dim: usize, largest: bool, sorted: bool, ) -> RusTorchResult<(Tensor<T>, ArrayD<i64>)>
Get top k elements along dimension (Phase 8 utilities) 次元に沿ってトップk要素を取得(フェーズ8ユーティリティ)
Sourcepub fn kthvalue(
&self,
k: usize,
dim: usize,
keepdim: bool,
) -> RusTorchResult<(Tensor<T>, ArrayD<i64>)>
pub fn kthvalue( &self, k: usize, dim: usize, keepdim: bool, ) -> RusTorchResult<(Tensor<T>, ArrayD<i64>)>
Get kth smallest/largest value k番目の最小/最大値を取得
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Tensor<T>
Source§impl<T: Float + 'static> Tensor<T>
impl<T: Float + 'static> Tensor<T>
Sourcepub fn save<P: AsRef<Path>>(&self, path: P) -> SerializationResult<()>
pub fn save<P: AsRef<Path>>(&self, path: P) -> SerializationResult<()>
Save tensor to file テンソルをファイルに保存
Sourcepub fn load<P: AsRef<Path>>(path: P) -> SerializationResult<Self>
pub fn load<P: AsRef<Path>>(path: P) -> SerializationResult<Self>
Load tensor from file
ファイルからテンソルを読み込み
Sourcepub fn clone_to_device(&self, device: Device) -> Self
pub fn clone_to_device(&self, device: Device) -> Self
Clone tensor with new device 新しいデバイスでテンソルをクローン
Sourcepub fn clone_with_grad(&self, requires_grad: bool) -> Self
pub fn clone_with_grad(&self, requires_grad: bool) -> Self
Clone tensor with new gradient requirement 新しい勾配要件でテンソルをクローン
Sourcepub fn get_metadata(&self) -> HashMap<String, String>
pub fn get_metadata(&self) -> HashMap<String, String>
Get tensor metadata for serialization シリアライゼーション用テンソルメタデータを取得
Source§impl<T: Float + Clone + 'static> Tensor<T>
Enhanced tensor operations with memory pool integration
メモリプール統合による拡張テンソル演算
impl<T: Float + Clone + 'static> Tensor<T>
Enhanced tensor operations with memory pool integration メモリプール統合による拡張テンソル演算
Sourcepub fn with_pool(shape: &[usize]) -> Self
pub fn with_pool(shape: &[usize]) -> Self
Create tensor with optimized memory allocation 最適化されたメモリ割り当てでテンソルを作成
Sourcepub fn matmul_pooled(&self, other: &Tensor<T>) -> Tensor<T>
pub fn matmul_pooled(&self, other: &Tensor<T>) -> Tensor<T>
Efficient matrix multiplication using memory pool メモリプールを使用した効率的な行列乗算
Sourcepub fn batch_add(&self, tensors: &[&Tensor<T>]) -> Vec<Tensor<T>>
pub fn batch_add(&self, tensors: &[&Tensor<T>]) -> Vec<Tensor<T>>
Batch operations with memory pool optimization メモリプール最適化によるバッチ演算
Sourcepub fn apply_pooled<F>(&self, f: F) -> Tensor<T>where
F: Fn(T) -> T,
pub fn apply_pooled<F>(&self, f: F) -> Tensor<T>where
F: Fn(T) -> T,
Memory-efficient element-wise operations メモリ効率的な要素ごと演算
Sourcepub fn sum_pooled(&self) -> T
pub fn sum_pooled(&self) -> T
Optimized reduction operations 最適化されたリダクション演算
Sourcepub fn pool_stats() -> String
pub fn pool_stats() -> String
Memory pool statistics for debugging デバッグ用メモリプール統計
Sourcepub fn clear_pools()
pub fn clear_pools()
Clear memory pools (useful for testing) メモリプールをクリア(テスト用)
Source§impl<T: Float + 'static> Tensor<Complex<T>>
Complex matrix operations
impl<T: Float + 'static> Tensor<Complex<T>>
Complex matrix operations
Sourcepub fn matmul(&self, other: &Self) -> Result<Self, String>
pub fn matmul(&self, other: &Self) -> Result<Self, String>
Complex matrix multiplication 複素行列の乗算
Sourcepub fn conj_transpose(&self) -> Result<Self, String>
pub fn conj_transpose(&self) -> Result<Self, String>
Complex matrix conjugate transpose (Hermitian transpose) 複素行列の共役転置(エルミート転置)
Sourcepub fn trace(&self) -> Result<Complex<T>, String>
pub fn trace(&self) -> Result<Complex<T>, String>
Complex matrix trace (sum of diagonal elements) 複素行列のトレース(対角要素の和)
Sourcepub fn determinant(&self) -> Result<Complex<T>, String>
pub fn determinant(&self) -> Result<Complex<T>, String>
Complex matrix determinant (2x2 only for now) 複素行列の行列式(現在は2x2のみ)
Sourcepub fn fft(
&self,
n: Option<usize>,
_dim: Option<isize>,
norm: Option<&str>,
) -> Result<Self, String>
pub fn fft( &self, n: Option<usize>, _dim: Option<isize>, norm: Option<&str>, ) -> Result<Self, String>
Forward FFT for complex tensor 複素テンソルの順フーリエ変換
Sourcepub fn ifft(
&self,
n: Option<usize>,
_dim: Option<isize>,
norm: Option<&str>,
) -> Result<Self, String>
pub fn ifft( &self, n: Option<usize>, _dim: Option<isize>, norm: Option<&str>, ) -> Result<Self, String>
Inverse FFT for complex tensor 複素テンソルの逆フーリエ変換
Source§impl<T: Float + 'static> Tensor<Complex<T>>
Complex tensor factory functions
impl<T: Float + 'static> Tensor<Complex<T>>
Complex tensor factory functions
Sourcepub fn complex_zeros(shape: &[usize]) -> Self
pub fn complex_zeros(shape: &[usize]) -> Self
Create a complex tensor with all zeros すべてゼロの複素テンソルを作成
Sourcepub fn complex_ones(shape: &[usize]) -> Self
pub fn complex_ones(shape: &[usize]) -> Self
Create a complex tensor with all ones すべて1の複素テンソルを作成
Sourcepub fn complex_i(shape: &[usize]) -> Self
pub fn complex_i(shape: &[usize]) -> Self
Create complex tensor filled with imaginary unit 虚数単位で満たされた複素テンソルを作成
Sourcepub fn from_polar(
magnitude: &Tensor<T>,
phase: &Tensor<T>,
) -> Result<Self, String>
pub fn from_polar( magnitude: &Tensor<T>, phase: &Tensor<T>, ) -> Result<Self, String>
Create complex tensor from polar coordinates 極座標から複素テンソルを作成
Source§impl<T: Float + 'static> Tensor<Complex<T>>
Complex mathematical operations for tensors
impl<T: Float + 'static> Tensor<Complex<T>>
Complex mathematical operations for tensors
Sourcepub fn ln(&self) -> Self
pub fn ln(&self) -> Self
Element-wise natural logarithm ln(z) for complex tensor 複素テンソルの要素ごとの自然対数 ln(z)
Sourcepub fn pow(&self, exponent: &Self) -> Result<Self, String>
pub fn pow(&self, exponent: &Self) -> Result<Self, String>
Element-wise power z^w for complex tensor 複素テンソルの要素ごとのべき乗 z^w
Sourcepub fn pow_scalar(&self, exponent: Complex<T>) -> Self
pub fn pow_scalar(&self, exponent: Complex<T>) -> Self
Element-wise power with scalar exponent z^s スカラー指数でのべき乗 z^s
Sourcepub fn sinh(&self) -> Self
pub fn sinh(&self) -> Self
Element-wise hyperbolic sine sinh(z) for complex tensor 複素テンソルの要素ごとの双曲正弦 sinh(z)
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Tensor<T>
Sourcepub fn add(&self, other: &Tensor<T>) -> RusTorchResult<Self>where
T: ScalarOperand + Copy,
pub fn add(&self, other: &Tensor<T>) -> RusTorchResult<Self>where
T: ScalarOperand + Copy,
Element-wise addition with another tensor 他のテンソルとの要素ごとの加算
Sourcepub fn sub(&self, other: &Tensor<T>) -> RusTorchResult<Self>where
T: ScalarOperand + Copy,
pub fn sub(&self, other: &Tensor<T>) -> RusTorchResult<Self>where
T: ScalarOperand + Copy,
Element-wise subtraction with another tensor 他のテンソルとの要素ごとの減算
Sourcepub fn mul(&self, other: &Tensor<T>) -> RusTorchResult<Self>where
T: ScalarOperand + Copy,
pub fn mul(&self, other: &Tensor<T>) -> RusTorchResult<Self>where
T: ScalarOperand + Copy,
Element-wise multiplication with another tensor 他のテンソルとの要素ごとの乗算
Sourcepub fn div(&self, other: &Tensor<T>) -> RusTorchResult<Self>where
T: ScalarOperand + Copy,
pub fn div(&self, other: &Tensor<T>) -> RusTorchResult<Self>where
T: ScalarOperand + Copy,
Element-wise division with another tensor 他のテンソルとの要素ごとの除算
Sourcepub fn add_scalar(&self, scalar: T) -> Self
pub fn add_scalar(&self, scalar: T) -> Self
Add scalar to all elements (new implementation) 全要素にスカラーを加算(新実装)
Sourcepub fn sub_scalar(&self, scalar: T) -> Self
pub fn sub_scalar(&self, scalar: T) -> Self
Subtract scalar from all elements (new implementation) 全要素からスカラーを減算(新実装)
Sourcepub fn mul_scalar(&self, scalar: T) -> Self
pub fn mul_scalar(&self, scalar: T) -> Self
Multiply all elements by scalar (new implementation) 全要素をスカラーで乗算(新実装)
Sourcepub fn div_scalar(&self, scalar: T) -> Self
pub fn div_scalar(&self, scalar: T) -> Self
Divide all elements by scalar (new implementation) 全要素をスカラーで除算(新実装)
Sourcepub fn maximum(&self, other: &Tensor<T>) -> RusTorchResult<Self>where
T: ScalarOperand + Copy,
pub fn maximum(&self, other: &Tensor<T>) -> RusTorchResult<Self>where
T: ScalarOperand + Copy,
Element-wise maximum with another tensor (new implementation) 他のテンソルとの要素ごとの最大値(新実装)
Sourcepub fn minimum(&self, other: &Tensor<T>) -> RusTorchResult<Self>where
T: ScalarOperand + Copy,
pub fn minimum(&self, other: &Tensor<T>) -> RusTorchResult<Self>where
T: ScalarOperand + Copy,
Element-wise minimum with another tensor (new implementation) 他のテンソルとの要素ごとの最小値(新実装)
Sourcepub fn sum_axis(&self, axis: usize) -> RusTorchResult<Tensor<T>>
pub fn sum_axis(&self, axis: usize) -> RusTorchResult<Tensor<T>>
Sum along a specific axis 特定の軸に沿って和を計算
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Tensor<T>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Tensor<T>
Sourcepub fn matmul(&self, other: &Tensor<T>) -> RusTorchResult<Self>
pub fn matmul(&self, other: &Tensor<T>) -> RusTorchResult<Self>
Matrix multiplication 行列乗算
Sourcepub fn transpose_last_two(&self) -> RusTorchResult<Self>
pub fn transpose_last_two(&self) -> RusTorchResult<Self>
Transpose the last two dimensions 最後の2次元を転置
Sourcepub fn transpose(&self) -> RusTorchResult<Self>
pub fn transpose(&self) -> RusTorchResult<Self>
Simple 2D transpose (new implementation) 単純な2D転置(新実装)
Sourcepub fn det(&self) -> RusTorchResult<T>
pub fn det(&self) -> RusTorchResult<T>
Compute determinant (for 2D square matrices only) 行列式の計算(2D正方行列のみ)
Sourcepub fn trace(&self) -> RusTorchResult<T>
pub fn trace(&self) -> RusTorchResult<T>
Trace (sum of diagonal elements) トレース(対角要素の和)
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Tensor<T>
pub fn matmul_metal( &self, other: &Tensor<T>, _device_id: usize, ) -> RusTorchResult<Self>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive + Default + Clone + Debug> Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive + Default + Clone + Debug> Tensor<T>
Sourcepub fn fft(
&self,
n: Option<usize>,
dim: Option<isize>,
norm: Option<&str>,
) -> Result<(Self, Self), String>
pub fn fft( &self, n: Option<usize>, dim: Option<isize>, norm: Option<&str>, ) -> Result<(Self, Self), String>
Fast Fourier Transform (basic implementation) 高速フーリエ変換(基本実装)
Sourcepub fn ifft(
&self,
real_part: &Self,
imag_part: &Self,
n: Option<usize>,
dim: Option<isize>,
norm: Option<&str>,
) -> Result<(Self, Self), String>
pub fn ifft( &self, real_part: &Self, imag_part: &Self, n: Option<usize>, dim: Option<isize>, norm: Option<&str>, ) -> Result<(Self, Self), String>
Inverse Fast Fourier Transform (basic implementation) 逆高速フーリエ変換(基本実装)
Sourcepub fn rfft(
&self,
n: Option<usize>,
dim: Option<isize>,
norm: Option<&str>,
) -> Result<(Self, Self), String>
pub fn rfft( &self, n: Option<usize>, dim: Option<isize>, norm: Option<&str>, ) -> Result<(Self, Self), String>
Real Fast Fourier Transform (basic implementation) 実数高速フーリエ変換(基本実装)
Sourcepub fn fftshift(&self, dim: Option<&[isize]>) -> Result<Self, String>
pub fn fftshift(&self, dim: Option<&[isize]>) -> Result<Self, String>
Shift zero-frequency component to center of spectrum ゼロ周波数成分をスペクトラムの中央にシフト
Sourcepub fn ifftshift(&self, dim: Option<&[isize]>) -> Result<Self, String>
pub fn ifftshift(&self, dim: Option<&[isize]>) -> Result<Self, String>
Inverse of fftshift fftshiftの逆
Sourcepub fn apply_window(
&self,
window_type: WindowType,
axis: Option<usize>,
) -> Result<Self, String>
pub fn apply_window( &self, window_type: WindowType, axis: Option<usize>, ) -> Result<Self, String>
Apply window function to the tensor テンソルに窓関数を適用
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Tensor<T>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Tensor<T>
Sourcepub fn batch_size(&self) -> usize
pub fn batch_size(&self) -> usize
Get the batch size (first dimension) バッチサイズを取得(最初の次元)
Sourcepub fn map<F>(&self, f: F) -> Tensor<T>where
F: Fn(T) -> T,
pub fn map<F>(&self, f: F) -> Tensor<T>where
F: Fn(T) -> T,
Apply function to each element 各要素に関数を適用
Sourcepub fn map_inplace<F>(&mut self, f: F)where
F: Fn(T) -> T,
pub fn map_inplace<F>(&mut self, f: F)where
F: Fn(T) -> T,
Apply function to each element in-place 各要素に関数をin-placeで適用
Sourcepub fn stack(tensors: &[&Tensor<T>]) -> RusTorchResult<Tensor<T>>
pub fn stack(tensors: &[&Tensor<T>]) -> RusTorchResult<Tensor<T>>
Stack tensors along a new axis (new implementation) 新しい軸に沿ってテンソルを積み重ね(新実装)
Sourcepub fn concatenate(
tensors: &[&Tensor<T>],
axis: usize,
) -> RusTorchResult<Tensor<T>>
pub fn concatenate( tensors: &[&Tensor<T>], axis: usize, ) -> RusTorchResult<Tensor<T>>
Concatenate tensors along an existing axis (new implementation) 既存の軸に沿ってテンソルを連結(新実装)
Sourcepub fn clone_tensor(&self) -> Self
pub fn clone_tensor(&self) -> Self
Clone tensor data (explicit for clarity) テンソルデータのクローン(明示的)
Sourcepub fn randn(shape: &[usize]) -> Tensor<T>where
StandardNormal: Distribution<T>,
pub fn randn(shape: &[usize]) -> Tensor<T>where
StandardNormal: Distribution<T>,
Create a tensor with random values from standard normal distribution 標準正規分布からランダムな値を持つテンソルを作成
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive + Clone + Debug> Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive + Clone + Debug> Tensor<T>
Sourcepub fn frobenius_norm(&self) -> T
pub fn frobenius_norm(&self) -> T
Calculate Frobenius norm for matrices 行列用フロベニウスノルムを計算
Sourcepub fn nuclear_norm(&self) -> RusTorchResult<T>
pub fn nuclear_norm(&self) -> RusTorchResult<T>
Calculate nuclear norm (sum of singular values) 核ノルム(特異値の和)を計算
Sourcepub fn svd(&self) -> RusTorchResult<(Tensor<T>, Tensor<T>, Tensor<T>)>
pub fn svd(&self) -> RusTorchResult<(Tensor<T>, Tensor<T>, Tensor<T>)>
Singular Value Decomposition (SVD) 特異値分解
Sourcepub fn eigh(&self) -> RusTorchResult<(Tensor<T>, Tensor<T>)>
pub fn eigh(&self) -> RusTorchResult<(Tensor<T>, Tensor<T>)>
Eigenvalue decomposition for symmetric matrices 対称行列用固有値分解
Sourcepub fn qr(&self) -> RusTorchResult<(Tensor<T>, Tensor<T>)>
pub fn qr(&self) -> RusTorchResult<(Tensor<T>, Tensor<T>)>
QR decomposition QR分解
Sourcepub fn cholesky(&self) -> RusTorchResult<Tensor<T>>
pub fn cholesky(&self) -> RusTorchResult<Tensor<T>>
Cholesky decomposition for positive definite matrices 正定値行列用コレスキー分解
Sourcepub fn inverse(&self) -> RusTorchResult<Tensor<T>>
pub fn inverse(&self) -> RusTorchResult<Tensor<T>>
Compute matrix inverse using LU decomposition LU分解を使用した逆行列の計算
Sourcepub fn pinv(&self) -> RusTorchResult<Tensor<T>>
pub fn pinv(&self) -> RusTorchResult<Tensor<T>>
Compute Moore-Penrose pseudo-inverse Moore-Penrose疑似逆行列の計算
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Tensor<T>
Sourcepub fn atan2(&self, other: &Tensor<T>) -> RusTorchResult<Self>
pub fn atan2(&self, other: &Tensor<T>) -> RusTorchResult<Self>
Apply two-argument arctangent element-wise 要素ごとに二引数アークタンジェントを適用
Sourcepub fn pow_tensor(&self, exponent: &Tensor<T>) -> RusTorchResult<Self>
pub fn pow_tensor(&self, exponent: &Tensor<T>) -> RusTorchResult<Self>
Raise elements to powers from another tensor 他のテンソルの要素をべき指数として使用
Sourcepub fn log(&self, base: T) -> Self
pub fn log(&self, base: T) -> Self
Apply logarithm with custom base element-wise 要素ごとにカスタム底の対数を適用
Sourcepub fn clamp(&self, min_val: T, max_val: T) -> Self
pub fn clamp(&self, min_val: T, max_val: T) -> Self
Clamp values between min and max 値をminとmaxの間にクランプ
Sourcepub fn lerp(&self, other: &Tensor<T>, weight: T) -> RusTorchResult<Self>
pub fn lerp(&self, other: &Tensor<T>, weight: T) -> RusTorchResult<Self>
Linear interpolation between two tensors 2つのテンソル間の線形補間
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive + PartialOrd + Clone> Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive + PartialOrd + Clone> Tensor<T>
Sourcepub fn var_unbiased(&self) -> T
pub fn var_unbiased(&self) -> T
Calculate unbiased variance along all dimensions 全次元での不偏分散を計算
Sourcepub fn var_axis(&self, axis: usize) -> RusTorchResult<Tensor<T>>
pub fn var_axis(&self, axis: usize) -> RusTorchResult<Tensor<T>>
Calculate variance along a specific axis 特定軸での分散を計算
Sourcepub fn std_unbiased(&self) -> T
pub fn std_unbiased(&self) -> T
Calculate unbiased standard deviation along all dimensions 全次元での不偏標準偏差を計算
Sourcepub fn std_axis(&self, axis: usize) -> RusTorchResult<Tensor<T>>
pub fn std_axis(&self, axis: usize) -> RusTorchResult<Tensor<T>>
Calculate standard deviation along a specific axis 特定軸での標準偏差を計算
Sourcepub fn quantile_advanced(&self, q: f64) -> RusTorchResult<T>
pub fn quantile_advanced(&self, q: f64) -> RusTorchResult<T>
Calculate quantile value (q between 0 and 1) - advanced version 分位数値を計算 (qは0から1の間) - 高度版
Sourcepub fn percentile(&self, p: f64) -> RusTorchResult<T>
pub fn percentile(&self, p: f64) -> RusTorchResult<T>
Calculate percentile value (p between 0 and 100) パーセンタイル値を計算 (pは0から100の間)
Sourcepub fn cumsum(&self, axis: usize) -> RusTorchResult<Tensor<T>>
pub fn cumsum(&self, axis: usize) -> RusTorchResult<Tensor<T>>
Calculate cumulative sum along a specific axis (simplified implementation) 特定軸での累積和を計算(簡単化実装)
Sourcepub fn cumprod(&self, axis: usize) -> RusTorchResult<Tensor<T>>
pub fn cumprod(&self, axis: usize) -> RusTorchResult<Tensor<T>>
Calculate cumulative product along a specific axis (simplified implementation) 特定軸での累積積を計算(簡单化実装)
Sourcepub fn argmin_axis(&self, axis: usize) -> RusTorchResult<Vec<usize>>
pub fn argmin_axis(&self, axis: usize) -> RusTorchResult<Vec<usize>>
Find indices of minimum values along an axis 軸に沿った最小値のインデックスを検索
Sourcepub fn argmax_axis(&self, axis: usize) -> RusTorchResult<Vec<usize>>
pub fn argmax_axis(&self, axis: usize) -> RusTorchResult<Vec<usize>>
Find indices of maximum values along an axis 軸に沿った最大値のインデックスを検索
Sourcepub fn topk(&self, k: usize) -> RusTorchResult<(Tensor<T>, Vec<usize>)>
pub fn topk(&self, k: usize) -> RusTorchResult<(Tensor<T>, Vec<usize>)>
Find top-k largest values and their indices 上位k個の最大値とそのインデックスを検索
Sourcepub fn bottomk(&self, k: usize) -> RusTorchResult<(Tensor<T>, Vec<usize>)>
pub fn bottomk(&self, k: usize) -> RusTorchResult<(Tensor<T>, Vec<usize>)>
Find bottom-k smallest values and their indices 下位k個の最小値とそのインデックスを検索
Sourcepub fn corrcoef(&self, other: &Tensor<T>) -> RusTorchResult<T>
pub fn corrcoef(&self, other: &Tensor<T>) -> RusTorchResult<T>
Calculate correlation coefficient between two 1D tensors 2つの1次元テンソル間の相関係数を計算
Sourcepub fn cov(&self, other: &Tensor<T>) -> RusTorchResult<T>
pub fn cov(&self, other: &Tensor<T>) -> RusTorchResult<T>
Calculate covariance between two 1D tensors 2つの1次元テンソル間の共分散を計算
Source§impl<T: Float + Clone + 'static> Tensor<T>
impl<T: Float + Clone + 'static> Tensor<T>
Sourcepub fn squeeze(&self) -> Self
pub fn squeeze(&self) -> Self
Remove singleton dimensions (size 1) from tensor テンソルから単一次元(サイズ1)を削除
§Ownership Patterns / 所有権パターン
squeeze()- Always creates new tensor (owned)squeeze_view()- Attempts zero-copy view, fallback to ownedsqueeze_inplace()- Modifies existing tensor (requires &mut)
§Examples
use rustorch::prelude::Tensor;
let tensor = Tensor::from_vec(vec![1.0, 2.0, 3.0], vec![1, 3, 1]);
// Always safe - creates new tensor
let squeezed = tensor.squeeze();
assert_eq!(squeezed.shape(), &[3]);
// Zero-copy when possible
let squeezed_view = tensor.squeeze_view().unwrap();
// In-place modification
let mut tensor_mut = tensor.clone();
tensor_mut.squeeze_inplace().unwrap();Sourcepub fn squeeze_view(&self) -> RusTorchResult<Self>
pub fn squeeze_view(&self) -> RusTorchResult<Self>
Remove singleton dimensions with zero-copy optimization ゼロコピー最適化で単一次元を削除
Sourcepub fn squeeze_inplace(&mut self) -> RusTorchResult<()>
pub fn squeeze_inplace(&mut self) -> RusTorchResult<()>
Remove singleton dimensions in-place (requires mutable reference) 単一次元をインプレースで削除(可変参照が必要)
Sourcepub fn squeeze_dim(&self, dim: usize) -> RusTorchResult<Self>
pub fn squeeze_dim(&self, dim: usize) -> RusTorchResult<Self>
Remove singleton dimensions from specific dimension 特定の次元から単一次元を削除
Sourcepub fn unsqueeze(&self, dim: usize) -> RusTorchResult<Self>
pub fn unsqueeze(&self, dim: usize) -> RusTorchResult<Self>
Add singleton dimension at specified position 指定位置に単一次元を追加
§Ownership Patterns / 所有権パターン
unsqueeze()- Always creates new tensor (owned)unsqueeze_view()- Attempts zero-copy viewunsqueeze_inplace()- Modifies existing tensor
§Examples
use rustorch::prelude::Tensor;
let tensor = Tensor::from_vec(vec![1.0, 2.0, 3.0], vec![3]);
// Add dimension at start
let unsqueezed = tensor.unsqueeze(0).unwrap();
assert_eq!(unsqueezed.shape(), &[1, 3]);
// Add dimension at end
let unsqueezed = tensor.unsqueeze(1).unwrap();
assert_eq!(unsqueezed.shape(), &[3, 1]);Sourcepub fn unsqueeze_view(&self, dim: usize) -> RusTorchResult<Self>
pub fn unsqueeze_view(&self, dim: usize) -> RusTorchResult<Self>
Add singleton dimension with zero-copy optimization ゼロコピー最適化で単一次元を追加
Sourcepub fn unsqueeze_inplace(&mut self, dim: usize) -> RusTorchResult<()>
pub fn unsqueeze_inplace(&mut self, dim: usize) -> RusTorchResult<()>
Add singleton dimension in-place 単一次元をインプレースで追加
Sourcepub fn expand_owned(&self, target_shape: &[usize]) -> RusTorchResult<Self>
pub fn expand_owned(&self, target_shape: &[usize]) -> RusTorchResult<Self>
Expand tensor dimensions through broadcasting (ownership-aware version) ブロードキャストによってテンソル次元を拡張(所有権対応版)
§Ownership Considerations / 所有権の考慮事項
Expand operations typically require data duplication, so we provide:
expand_owned()- Creates new tensor with explicit memory allocationexpand_lazy()- Returns lazy view that computes on access (memory efficient)expand_shared()- Uses shared ownership with Arc for memory efficiency
§Examples
use rustorch::prelude::Tensor;
let tensor = Tensor::from_vec(vec![1.0, 2.0, 3.0], vec![1, 3]);
// Expand to larger shape
let expanded = tensor.expand_owned(&[4, 3]).unwrap();
assert_eq!(expanded.shape(), &[4, 3]);
// Memory-efficient lazy expansion
let lazy_expanded = tensor.expand_lazy(&[4, 3]).unwrap();Expand with shared ownership for memory efficiency メモリ効率のための共有所有権で拡張
Sourcepub fn expand_lazy(
&self,
target_shape: &[usize],
) -> RusTorchResult<LazyExpandedTensor<T>>
pub fn expand_lazy( &self, target_shape: &[usize], ) -> RusTorchResult<LazyExpandedTensor<T>>
Lazy expand that defers computation until access アクセス時まで計算を遅延する遅延拡張
Sourcepub fn flatten_owned(&self) -> Self
pub fn flatten_owned(&self) -> Self
Flatten tensor dimensions into 1D (ownership-aware version) テンソル次元を1Dに平坦化(所有権対応版)
§Ownership Patterns / 所有権パターン
flatten_owned()- Always creates new 1D tensorflatten_range()- Flatten specific dimension rangeflatten_inplace()- In-place flattening when possibleflatten_view()- Zero-copy view when layout allows
§Examples
use rustorch::prelude::Tensor;
let tensor = Tensor::from_vec(vec![1.0, 2.0, 3.0, 4.0], vec![2, 2]);
// Full flatten
let flattened = tensor.flatten_owned();
assert_eq!(flattened.shape(), &[4]);
// Flatten from specific dimension
let partial_flatten = tensor.flatten_range(1, None).unwrap();
assert_eq!(partial_flatten.shape(), &[2, 2]);Sourcepub fn flatten_range(
&self,
start_dim: usize,
end_dim: Option<usize>,
) -> RusTorchResult<Self>
pub fn flatten_range( &self, start_dim: usize, end_dim: Option<usize>, ) -> RusTorchResult<Self>
Flatten specific dimension range 特定の次元範囲を平坦化
Sourcepub fn flatten_inplace(&mut self) -> RusTorchResult<()>
pub fn flatten_inplace(&mut self) -> RusTorchResult<()>
Flatten in-place when layout allows レイアウトが許可する場合のインプレース平坦化
Sourcepub fn flatten_view(&self) -> RusTorchResult<Self>
pub fn flatten_view(&self) -> RusTorchResult<Self>
Zero-copy flatten when memory layout allows メモリレイアウトが許可する場合のゼロコピー平坦化
Sourcepub fn is_contiguous(&self) -> bool
pub fn is_contiguous(&self) -> bool
Check if tensor data is contiguous in memory テンソルデータがメモリ内で連続しているかチェック
Sourcepub fn can_broadcast_with(&self, other: &Self) -> bool
pub fn can_broadcast_with(&self, other: &Self) -> bool
Check if this tensor can broadcast with another tensor このテンソルが別のテンソルとブロードキャスト可能かチェック
Sourcepub fn broadcast_with(&self, other: &Self) -> RusTorchResult<(Self, Self)>
pub fn broadcast_with(&self, other: &Self) -> RusTorchResult<(Self, Self)>
Broadcast two tensors to compatible shapes 2つのテンソルを互換形状にブロードキャスト
Sourcepub fn expand_dims(&self, axis: usize) -> RusTorchResult<Self>
pub fn expand_dims(&self, axis: usize) -> RusTorchResult<Self>
Add singleton dimension (alias for unsqueeze for compatibility) 単一次元追加(互換性のためのunsqueezeエイリアス)
Sourcepub fn expand_as(&self, other: &Self) -> RusTorchResult<Self>
pub fn expand_as(&self, other: &Self) -> RusTorchResult<Self>
Expand tensor to match the shape of another tensor (PyTorch expand_as compatibility) 他のテンソルの形状に合わせて拡張(PyTorch expand_as互換)
§Examples
use rustorch::prelude::Tensor;
let tensor = Tensor::from_vec(vec![1.0, 2.0], vec![1, 2]);
let target = Tensor::from_vec(vec![0.0; 6], vec![3, 2]);
let expanded = tensor.expand_as(&target).unwrap();
assert_eq!(expanded.shape(), target.shape());Sourcepub fn unflatten(&self, dim: usize, sizes: &[usize]) -> RusTorchResult<Self>
pub fn unflatten(&self, dim: usize, sizes: &[usize]) -> RusTorchResult<Self>
Unflatten a tensor dimension into multiple dimensions テンソルの次元を複数の次元に復元
§Arguments
dim- Dimension to unflattensizes- Target sizes for new dimensions
§Examples
use rustorch::prelude::Tensor;
let tensor = Tensor::from_vec(vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0], vec![6]);
let unflattened = tensor.unflatten(0, &[2, 3]).unwrap();
assert_eq!(unflattened.shape(), &[2, 3]);Sourcepub fn repeat(&self, repeats: &[usize]) -> RusTorchResult<Self>
pub fn repeat(&self, repeats: &[usize]) -> RusTorchResult<Self>
Repeat tensor along specified dimensions (PyTorch repeat compatibility) 指定された次元に沿ってテンソルを繰り返し(PyTorch repeat互換)
§Arguments
repeats- Number of repetitions for each dimension
§Examples
use rustorch::prelude::Tensor;
let tensor = Tensor::from_vec(vec![1.0, 2.0], vec![2]);
let repeated = tensor.repeat(&[3, 2]).unwrap();
assert_eq!(repeated.shape(), &[3, 4]); // [3, 2*2]Sourcepub fn repeat_interleave_scalar(
&self,
repeats: usize,
dim: Option<usize>,
) -> RusTorchResult<Self>
pub fn repeat_interleave_scalar( &self, repeats: usize, dim: Option<usize>, ) -> RusTorchResult<Self>
Repeat elements of tensor along specified dimension 指定次元に沿ってテンソルの要素を繰り返し
§Arguments
repeats- Number of repetitions for each element (scalar or tensor)dim- Dimension along which to repeat (optional)
§Examples
use rustorch::prelude::Tensor;
let tensor = Tensor::from_vec(vec![1.0, 2.0, 3.0], vec![3]);
let repeated = tensor.repeat_interleave_scalar(2, Some(0)).unwrap();
assert_eq!(repeated.shape(), &[6]); // Each element repeated twiceSourcepub fn roll_1d(&self, shifts: isize, dim: Option<usize>) -> RusTorchResult<Self>
pub fn roll_1d(&self, shifts: isize, dim: Option<usize>) -> RusTorchResult<Self>
Roll tensor along specified dimensions 指定された次元に沿ってテンソルをロール
§Arguments
shifts- Number of places to shiftdims- Dimensions to roll along (optional)
§Examples
use rustorch::prelude::Tensor;
let tensor = Tensor::from_vec(vec![1.0, 2.0, 3.0, 4.0], vec![4]);
let rolled = tensor.roll_1d(1, Some(0)).unwrap();
// Result: [4.0, 1.0, 2.0, 3.0]Sourcepub fn rot90(&self, k: isize, dims: &[usize]) -> RusTorchResult<Self>
pub fn rot90(&self, k: isize, dims: &[usize]) -> RusTorchResult<Self>
Rotate tensor 90 degrees in the plane specified by dims 指定された次元平面でテンソルを90度回転
§Arguments
k- Number of 90-degree rotationsdims- Two dimensions defining the rotation plane
§Examples
use rustorch::prelude::Tensor;
let tensor = Tensor::from_vec(vec![1.0, 2.0, 3.0, 4.0], vec![2, 2]);
let rotated = tensor.rot90(1, &[0, 1]).unwrap();
// 90-degree rotationSourcepub fn flip(&self, dims: &[usize]) -> RusTorchResult<Self>
pub fn flip(&self, dims: &[usize]) -> RusTorchResult<Self>
Sourcepub fn fliplr(&self) -> RusTorchResult<Self>
pub fn fliplr(&self) -> RusTorchResult<Self>
Flip tensor left-right (along last dimension) テンソルを左右反転(最後の次元に沿って)
§Examples
use rustorch::prelude::Tensor;
let tensor = Tensor::from_vec(vec![1.0, 2.0, 3.0, 4.0], vec![2, 2]);
let flipped = tensor.fliplr().unwrap();Sourcepub fn flipud(&self) -> RusTorchResult<Self>
pub fn flipud(&self) -> RusTorchResult<Self>
Flip tensor up-down (along first dimension)
テンソルを上下反転(最初の次元に沿って)
§Examples
use rustorch::prelude::Tensor;
let tensor = Tensor::from_vec(vec![1.0, 2.0, 3.0, 4.0], vec![2, 2]);
let flipped = tensor.flipud().unwrap();Source§impl<T: Float + Clone + 'static> Tensor<T>
Convenient methods for common shape operation patterns
一般的な形状操作パターンの便利なメソッド
impl<T: Float + Clone + 'static> Tensor<T>
Convenient methods for common shape operation patterns 一般的な形状操作パターンの便利なメソッド
Sourcepub fn view_shape(&self, shape: &[usize]) -> RusTorchResult<Self>
pub fn view_shape(&self, shape: &[usize]) -> RusTorchResult<Self>
PyTorch-like view method for reshaping with ownership semantics 所有権セマンティクスでのPyTorchライクなviewメソッド
Sourcepub fn shape_builder(self) -> ShapeBuilder<T>
pub fn shape_builder(self) -> ShapeBuilder<T>
Create shape builder for chaining operations 操作チェーン用の形状ビルダーを作成
Source§impl<T: Float + Send + Sync + Clone + 'static> Tensor<T>
Parallel batch operations for tensors
テンソルの並列バッチ演算
impl<T: Float + Send + Sync + Clone + 'static> Tensor<T>
Parallel batch operations for tensors テンソルの並列バッチ演算
Sourcepub fn batch_matmul_parallel(
&self,
other: &Tensor<T>,
) -> RusTorchResult<Tensor<T>>
pub fn batch_matmul_parallel( &self, other: &Tensor<T>, ) -> RusTorchResult<Tensor<T>>
Parallel batch matrix multiplication 並列バッチ行列乗算
Sourcepub fn batch_add_parallel(&self, other: &Tensor<T>) -> RusTorchResult<Tensor<T>>
pub fn batch_add_parallel(&self, other: &Tensor<T>) -> RusTorchResult<Tensor<T>>
Parallel batch element-wise operations 並列バッチ要素ごと演算
Sourcepub fn batch_mul_scalar_parallel(&self, scalar: T) -> Tensor<T>
pub fn batch_mul_scalar_parallel(&self, scalar: T) -> Tensor<T>
Parallel batch scalar multiplication 並列バッチスカラー乗算
Sourcepub fn batch_normalize_parallel(&self, epsilon: T) -> Tensor<T>
pub fn batch_normalize_parallel(&self, epsilon: T) -> Tensor<T>
Parallel batch normalization 並列バッチ正規化
Sourcepub fn batch_conv2d_parallel(
&self,
kernel: &Tensor<T>,
stride: usize,
padding: usize,
) -> RusTorchResult<Tensor<T>>
pub fn batch_conv2d_parallel( &self, kernel: &Tensor<T>, stride: usize, padding: usize, ) -> RusTorchResult<Tensor<T>>
Parallel batch convolution (simplified 2D) 並列バッチ畳み込み(簡略化2D)
Sourcepub fn batch_sum_parallel(&self, dim: usize) -> RusTorchResult<Tensor<T>>
pub fn batch_sum_parallel(&self, dim: usize) -> RusTorchResult<Tensor<T>>
Parallel batch reduction operations 並列バッチリダクション演算
Sourcepub fn batch_mean_parallel(&self, dim: usize) -> RusTorchResult<Tensor<T>>
pub fn batch_mean_parallel(&self, dim: usize) -> RusTorchResult<Tensor<T>>
Parallel batch mean computation 並列バッチ平均計算
Source§impl Tensor<f32>
Specialized f32 implementations with SIMD integration
SIMD統合を含むf32特殊化実装
impl Tensor<f32>
Specialized f32 implementations with SIMD integration SIMD統合を含むf32特殊化実装
Sourcepub fn batch_simd_add_parallel(
&self,
other: &Tensor<f32>,
) -> RusTorchResult<Tensor<f32>>
pub fn batch_simd_add_parallel( &self, other: &Tensor<f32>, ) -> RusTorchResult<Tensor<f32>>
High-performance parallel batch operations for f32 f32用高性能並列バッチ演算
Sourcepub fn batch_simd_matmul_parallel(
&self,
other: &Tensor<f32>,
) -> RusTorchResult<Tensor<f32>>
pub fn batch_simd_matmul_parallel( &self, other: &Tensor<f32>, ) -> RusTorchResult<Tensor<f32>>
Parallel batch matrix multiplication with SIMD optimization SIMD最適化を含む並列バッチ行列乗算
Source§impl<T: Float + Send + Sync + Clone + 'static + ScalarOperand + FromPrimitive> Tensor<T>
impl<T: Float + Send + Sync + Clone + 'static + ScalarOperand + FromPrimitive> Tensor<T>
Sourcepub fn gpu_mean(&self, dim: Option<usize>) -> RusTorchResult<Tensor<T>>where
T: FromPrimitive,
pub fn gpu_mean(&self, dim: Option<usize>) -> RusTorchResult<Tensor<T>>where
T: FromPrimitive,
GPU mean operation
Sourcepub fn gpu_std(&self, dim: Option<usize>) -> RusTorchResult<Tensor<T>>
pub fn gpu_std(&self, dim: Option<usize>) -> RusTorchResult<Tensor<T>>
GPU standard deviation operation
Sourcepub fn gpu_batch_matmul(&self, other: &Tensor<T>) -> RusTorchResult<Tensor<T>>
pub fn gpu_batch_matmul(&self, other: &Tensor<T>) -> RusTorchResult<Tensor<T>>
GPU batch matrix multiplication
Source§impl<T: Float + Clone + 'static> Tensor<T>
Extensions for regular Tensor to work with SIMD-aligned tensors
通常のTensorがSIMDアライメントテンソルと連携するための拡張
impl<T: Float + Clone + 'static> Tensor<T>
Extensions for regular Tensor to work with SIMD-aligned tensors 通常のTensorがSIMDアライメントテンソルと連携するための拡張
Sourcepub fn to_simd_aligned(&self) -> RusTorchResult<SimdTensor<T>>
pub fn to_simd_aligned(&self) -> RusTorchResult<SimdTensor<T>>
Convert to SIMD-aligned tensor (f32 only) SIMDアライメントテンソルに変換(f32のみ)
Sourcepub fn zeros_simd_aligned(shape: &[usize]) -> Selfwhere
T: 'static,
pub fn zeros_simd_aligned(shape: &[usize]) -> Selfwhere
T: 'static,
Create tensor with SIMD-aligned allocation strategy SIMDアライメント割り当て戦略でテンソルを作成
Trait Implementations§
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Add<T> for &Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Add<T> for &Tensor<T>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Add<T> for Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Add<T> for Tensor<T>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Add for &Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Add for &Tensor<T>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Add for Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Add for Tensor<T>
Source§impl Avx512TensorOps<f32> for Tensor<f32>
impl Avx512TensorOps<f32> for Tensor<f32>
Source§fn avx512_add(&self, other: &Self) -> RusTorchResult<Self>
fn avx512_add(&self, other: &Self) -> RusTorchResult<Self>
Source§fn avx512_mul(&self, other: &Self) -> RusTorchResult<Self>
fn avx512_mul(&self, other: &Self) -> RusTorchResult<Self>
AVX-512最適化を使った要素ごとの乗算
Source§fn avx512_dot(&self, other: &Self) -> RusTorchResult<f32>
fn avx512_dot(&self, other: &Self) -> RusTorchResult<f32>
Source§impl Avx512TensorOps<f64> for Tensor<f64>
impl Avx512TensorOps<f64> for Tensor<f64>
Source§fn avx512_add(&self, other: &Self) -> RusTorchResult<Self>
fn avx512_add(&self, other: &Self) -> RusTorchResult<Self>
Source§fn avx512_mul(&self, other: &Self) -> RusTorchResult<Self>
fn avx512_mul(&self, other: &Self) -> RusTorchResult<Self>
AVX-512最適化を使った要素ごとの乗算
Source§fn avx512_dot(&self, other: &Self) -> RusTorchResult<f64>
fn avx512_dot(&self, other: &Self) -> RusTorchResult<f64>
Source§impl<T: Float + Send + Sync + Clone + 'static> BatchParallelOp<T> for Tensor<T>
impl<T: Float + Send + Sync + Clone + 'static> BatchParallelOp<T> for Tensor<T>
Source§fn batch_elementwise_op<F>(
&self,
other: &Tensor<T>,
op: F,
) -> RusTorchResult<Tensor<T>>
fn batch_elementwise_op<F>( &self, other: &Tensor<T>, op: F, ) -> RusTorchResult<Tensor<T>>
Source§fn batch_scalar_op<F>(&self, scalar: T, op: F) -> Tensor<T>
fn batch_scalar_op<F>(&self, scalar: T, op: F) -> Tensor<T>
Source§fn batch_normalize(&self, epsilon: T) -> Tensor<T>
fn batch_normalize(&self, epsilon: T) -> Tensor<T>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Div<T> for &Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Div<T> for &Tensor<T>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Div<T> for Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Div<T> for Tensor<T>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Div for &Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Div for &Tensor<T>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Div for Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Div for Tensor<T>
Source§impl<T: Float + FromPrimitive + ScalarOperand + Send + Sync + 'static> GpuActivation<T> for Tensor<T>
Available on neither crate feature coreml nor crate feature coreml-hybrid nor crate feature coreml-fallback.
impl<T: Float + FromPrimitive + ScalarOperand + Send + Sync + 'static> GpuActivation<T> for Tensor<T>
coreml nor crate feature coreml-hybrid nor crate feature coreml-fallback.Source§fn gpu_relu(&self) -> RusTorchResult<Tensor<T>>
fn gpu_relu(&self) -> RusTorchResult<Tensor<T>>
Source§fn gpu_sigmoid(&self) -> RusTorchResult<Tensor<T>>
fn gpu_sigmoid(&self) -> RusTorchResult<Tensor<T>>
Source§fn gpu_tanh(&self) -> RusTorchResult<Tensor<T>>
fn gpu_tanh(&self) -> RusTorchResult<Tensor<T>>
Source§fn gpu_softmax(&self, dim: isize) -> RusTorchResult<Tensor<T>>
fn gpu_softmax(&self, dim: isize) -> RusTorchResult<Tensor<T>>
Source§fn gpu_gelu(&self) -> RusTorchResult<Tensor<T>>
fn gpu_gelu(&self) -> RusTorchResult<Tensor<T>>
Source§fn gpu_leaky_relu(&self, negative_slope: f64) -> RusTorchResult<Tensor<T>>
fn gpu_leaky_relu(&self, negative_slope: f64) -> RusTorchResult<Tensor<T>>
Source§fn gpu_swish(&self) -> RusTorchResult<Tensor<T>>
fn gpu_swish(&self) -> RusTorchResult<Tensor<T>>
Source§impl<T> GpuBatchParallelOp<T> for Tensor<T>
Available on non-crate feature cuda only.
impl<T> GpuBatchParallelOp<T> for Tensor<T>
cuda only.Source§fn gpu_batch_normalize(&self, epsilon: T) -> RusTorchResult<Tensor<T>>
fn gpu_batch_normalize(&self, epsilon: T) -> RusTorchResult<Tensor<T>>
Source§fn gpu_batch_conv2d(
&self,
kernel: &Tensor<T>,
stride: usize,
padding: usize,
) -> RusTorchResult<Tensor<T>>
fn gpu_batch_conv2d( &self, kernel: &Tensor<T>, stride: usize, padding: usize, ) -> RusTorchResult<Tensor<T>>
Source§fn gpu_batch_attention(
&self,
key: &Tensor<T>,
value: &Tensor<T>,
) -> RusTorchResult<Tensor<T>>
fn gpu_batch_attention( &self, key: &Tensor<T>, value: &Tensor<T>, ) -> RusTorchResult<Tensor<T>>
Source§impl<T: Float + FromPrimitive + ScalarOperand + Send + Sync + 'static> GpuConvolution<T> for Tensor<T>
Available on neither crate feature coreml nor crate feature coreml-hybrid nor crate feature coreml-fallback.
impl<T: Float + FromPrimitive + ScalarOperand + Send + Sync + 'static> GpuConvolution<T> for Tensor<T>
coreml nor crate feature coreml-hybrid nor crate feature coreml-fallback.Source§fn gpu_conv2d(
&self,
kernel: &Self,
params: &ConvolutionParams,
) -> RusTorchResult<Tensor<T>>
fn gpu_conv2d( &self, kernel: &Self, params: &ConvolutionParams, ) -> RusTorchResult<Tensor<T>>
Source§fn gpu_conv_transpose2d(
&self,
kernel: &Self,
params: &ConvolutionParams,
) -> RusTorchResult<Tensor<T>>
fn gpu_conv_transpose2d( &self, kernel: &Self, params: &ConvolutionParams, ) -> RusTorchResult<Tensor<T>>
Source§fn gpu_depthwise_conv2d(
&self,
kernel: &Self,
params: &ConvolutionParams,
) -> RusTorchResult<Tensor<T>>
fn gpu_depthwise_conv2d( &self, kernel: &Self, params: &ConvolutionParams, ) -> RusTorchResult<Tensor<T>>
Source§fn gpu_grouped_conv2d(
&self,
kernel: &Self,
params: &ConvolutionParams,
groups: usize,
) -> RusTorchResult<Tensor<T>>
fn gpu_grouped_conv2d( &self, kernel: &Self, params: &ConvolutionParams, groups: usize, ) -> RusTorchResult<Tensor<T>>
Source§fn gpu_conv3d(
&self,
kernel: &Self,
params: &ConvolutionParams,
) -> RusTorchResult<Tensor<T>>
fn gpu_conv3d( &self, kernel: &Self, params: &ConvolutionParams, ) -> RusTorchResult<Tensor<T>>
Source§impl<T: Float + FromPrimitive + ScalarOperand + Send + Sync + 'static> GpuLinearAlgebra<T> for Tensor<T>
impl<T: Float + FromPrimitive + ScalarOperand + Send + Sync + 'static> GpuLinearAlgebra<T> for Tensor<T>
Source§fn gpu_matmul(&self, other: &Self) -> RusTorchResult<Tensor<T>>
fn gpu_matmul(&self, other: &Self) -> RusTorchResult<Tensor<T>>
Source§fn gpu_batch_matmul(&self, other: &Self) -> RusTorchResult<Tensor<T>>
fn gpu_batch_matmul(&self, other: &Self) -> RusTorchResult<Tensor<T>>
Source§fn gpu_matvec(&self, vector: &Self) -> RusTorchResult<Tensor<T>>
fn gpu_matvec(&self, vector: &Self) -> RusTorchResult<Tensor<T>>
Source§impl<T> GpuParallelOp<T> for Tensor<T>
Available on non-crate feature cuda only.
impl<T> GpuParallelOp<T> for Tensor<T>
cuda only.Source§fn gpu_elementwise_op<F>(
&self,
other: &Tensor<T>,
op: F,
) -> RusTorchResult<Tensor<T>>
fn gpu_elementwise_op<F>( &self, other: &Tensor<T>, op: F, ) -> RusTorchResult<Tensor<T>>
Source§fn gpu_matmul(&self, other: &Tensor<T>) -> RusTorchResult<Tensor<T>>
fn gpu_matmul(&self, other: &Tensor<T>) -> RusTorchResult<Tensor<T>>
Source§fn gpu_reduce<F, R>(
&self,
dim: usize,
init: R,
op: F,
) -> RusTorchResult<Tensor<T>>
fn gpu_reduce<F, R>( &self, dim: usize, init: R, op: F, ) -> RusTorchResult<Tensor<T>>
Source§fn to_device(&self, _device: DeviceType) -> RusTorchResult<Tensor<T>>
fn to_device(&self, _device: DeviceType) -> RusTorchResult<Tensor<T>>
Source§fn to_cpu(&self) -> RusTorchResult<Tensor<T>>
fn to_cpu(&self) -> RusTorchResult<Tensor<T>>
Source§impl<T: Float + FromPrimitive + ScalarOperand + 'static> GpuReduction<T> for Tensor<T>
impl<T: Float + FromPrimitive + ScalarOperand + 'static> GpuReduction<T> for Tensor<T>
Source§impl<T: Float + 'static> Loadable for Tensor<T>
impl<T: Float + 'static> Loadable for Tensor<T>
Source§fn load_binary(data: &[u8]) -> SerializationResult<Self>
fn load_binary(data: &[u8]) -> SerializationResult<Self>
Source§fn expected_type_id() -> &'static str
fn expected_type_id() -> &'static str
Source§fn validate_version(version: &str) -> SerializationResult<()>
fn validate_version(version: &str) -> SerializationResult<()>
Source§impl<T: Float + Send + Sync + Clone + 'static> MatrixParallelOp<T> for Tensor<T>
impl<T: Float + Send + Sync + Clone + 'static> MatrixParallelOp<T> for Tensor<T>
Source§fn batch_matmul(&self, other: &Tensor<T>) -> RusTorchResult<Tensor<T>>
fn batch_matmul(&self, other: &Tensor<T>) -> RusTorchResult<Tensor<T>>
Source§fn batch_conv2d(
&self,
kernel: &Tensor<T>,
stride: usize,
padding: usize,
) -> RusTorchResult<Tensor<T>>
fn batch_conv2d( &self, kernel: &Tensor<T>, stride: usize, padding: usize, ) -> RusTorchResult<Tensor<T>>
Source§impl<T: Float + Clone + 'static> MemoryOptimization<T> for Tensor<T>
impl<T: Float + Clone + 'static> MemoryOptimization<T> for Tensor<T>
Source§fn memory_info(&self) -> TensorMemoryInfo
fn memory_info(&self) -> TensorMemoryInfo
Source§fn can_optimize_memory(&self) -> bool
fn can_optimize_memory(&self) -> bool
Source§fn optimize_memory(&self) -> Self
fn optimize_memory(&self) -> Self
Source§fn try_optimize_memory(&self) -> RusTorchResult<Self>
fn try_optimize_memory(&self) -> RusTorchResult<Self>
Source§impl MixedPrecisionTensor<f32> for Tensor<f32>
impl MixedPrecisionTensor<f32> for Tensor<f32>
Source§fn can_cast_to(&self, dtype: DType) -> bool
fn can_cast_to(&self, dtype: DType) -> bool
Source§fn memory_footprint(&self) -> usize
fn memory_footprint(&self) -> usize
Source§fn memory_footprint_for_dtype(&self, dtype: DType) -> usize
fn memory_footprint_for_dtype(&self, dtype: DType) -> usize
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Mul<T> for &Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Mul<T> for &Tensor<T>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Mul<T> for Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Mul<T> for Tensor<T>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Mul for &Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Mul for &Tensor<T>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Mul for Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Mul for Tensor<T>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Neg for &Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Neg for &Tensor<T>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Neg for Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Neg for Tensor<T>
Source§impl<T: Float + Send + Sync + Clone + 'static> ParallelOp<T> for Tensor<T>
Tensorの並列操作実装
Parallel operations implementation for Tensor
impl<T: Float + Send + Sync + Clone + 'static> ParallelOp<T> for Tensor<T>
Tensorの並列操作実装 Parallel operations implementation for Tensor
Source§const MIN_PARALLEL_SIZE: usize = 1_000usize
const MIN_PARALLEL_SIZE: usize = 1_000usize
Source§fn should_parallelize(&self, size: usize) -> bool
fn should_parallelize(&self, size: usize) -> bool
Source§impl<T: Float + Send + Sync + Clone + 'static> ReductionParallelOp<T> for Tensor<T>
impl<T: Float + Send + Sync + Clone + 'static> ReductionParallelOp<T> for Tensor<T>
Source§fn parallel_reduce<F, R>(
&self,
dim: usize,
init: R,
op: F,
) -> RusTorchResult<Tensor<T>>
fn parallel_reduce<F, R>( &self, dim: usize, init: R, op: F, ) -> RusTorchResult<Tensor<T>>
Source§fn parallel_mean(&self, dim: usize) -> RusTorchResult<Tensor<T>>
fn parallel_mean(&self, dim: usize) -> RusTorchResult<Tensor<T>>
Source§fn parallel_sum(&self, dim: usize) -> RusTorchResult<Tensor<T>>
fn parallel_sum(&self, dim: usize) -> RusTorchResult<Tensor<T>>
Source§impl<T: Float + 'static> Saveable for Tensor<T>
Tensor serialization utilities
テンソルシリアライゼーションユーティリティ
impl<T: Float + 'static> Saveable for Tensor<T>
Tensor serialization utilities テンソルシリアライゼーションユーティリティ
Source§fn save_binary(&self) -> SerializationResult<Vec<u8>>
fn save_binary(&self) -> SerializationResult<Vec<u8>>
Source§impl<T: Float + Clone + 'static> ShapeOps<T> for Tensor<T>
impl<T: Float + Clone + 'static> ShapeOps<T> for Tensor<T>
Source§fn shapes(self) -> ShapeBuilder<T>
fn shapes(self) -> ShapeBuilder<T>
Create shape builder for fluent operations フルエント操作のためのシェイプビルダーを作成
Source§impl SimdParallelOp for Tensor<f32>
f32特化のSIMD並列操作実装
SIMD parallel operations implementation specialized for f32
impl SimdParallelOp for Tensor<f32>
f32特化のSIMD並列操作実装 SIMD parallel operations implementation specialized for f32
Source§fn simd_parallel_add(&self, other: &Tensor<f32>) -> RusTorchResult<Tensor<f32>>
fn simd_parallel_add(&self, other: &Tensor<f32>) -> RusTorchResult<Tensor<f32>>
Source§fn simd_parallel_matmul(
&self,
other: &Tensor<f32>,
) -> RusTorchResult<Tensor<f32>>
fn simd_parallel_matmul( &self, other: &Tensor<f32>, ) -> RusTorchResult<Tensor<f32>>
Source§impl<T> SpecialFunctions<T> for Tensor<T>
Implementation of special functions for Tensor
impl<T> SpecialFunctions<T> for Tensor<T>
Implementation of special functions for Tensor
Source§fn gamma(&self) -> RusTorchResult<Tensor<T>>
fn gamma(&self) -> RusTorchResult<Tensor<T>>
Source§fn lgamma(&self) -> RusTorchResult<Tensor<T>>
fn lgamma(&self) -> RusTorchResult<Tensor<T>>
Source§fn digamma(&self) -> RusTorchResult<Tensor<T>>
fn digamma(&self) -> RusTorchResult<Tensor<T>>
Source§fn erf(&self) -> RusTorchResult<Tensor<T>>
fn erf(&self) -> RusTorchResult<Tensor<T>>
Source§fn erfc(&self) -> RusTorchResult<Tensor<T>>
fn erfc(&self) -> RusTorchResult<Tensor<T>>
Source§fn erfinv(&self) -> RusTorchResult<Tensor<T>>
fn erfinv(&self) -> RusTorchResult<Tensor<T>>
Source§fn bessel_j(&self, n: T) -> RusTorchResult<Tensor<T>>
fn bessel_j(&self, n: T) -> RusTorchResult<Tensor<T>>
Source§fn bessel_y(&self, n: T) -> RusTorchResult<Tensor<T>>
fn bessel_y(&self, n: T) -> RusTorchResult<Tensor<T>>
Source§fn bessel_i(&self, n: T) -> RusTorchResult<Tensor<T>>
fn bessel_i(&self, n: T) -> RusTorchResult<Tensor<T>>
Source§fn bessel_k(&self, n: T) -> RusTorchResult<Tensor<T>>
fn bessel_k(&self, n: T) -> RusTorchResult<Tensor<T>>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Sub<T> for &Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Sub<T> for &Tensor<T>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Sub<T> for Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Sub<T> for Tensor<T>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Sub for &Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Sub for &Tensor<T>
Source§impl<T: Float + 'static + ScalarOperand + FromPrimitive> Sub for Tensor<T>
impl<T: Float + 'static + ScalarOperand + FromPrimitive> Sub for Tensor<T>
Source§impl<T: Float + Clone + 'static> TensorIterOps<T> for Tensor<T>
impl<T: Float + Clone + 'static> TensorIterOps<T> for Tensor<T>
Source§impl<T: Float + Quantizable<QuantizedType = i8>> TensorQuantization<T> for Tensor<T>
impl<T: Float + Quantizable<QuantizedType = i8>> TensorQuantization<T> for Tensor<T>
Source§fn quantize_dynamic(
&self,
scheme: QuantizationScheme,
) -> RusTorchResult<QuantizedTensor<i8>>
fn quantize_dynamic( &self, scheme: QuantizationScheme, ) -> RusTorchResult<QuantizedTensor<i8>>
Source§fn quantize_static(
&self,
scale: f32,
zero_point: i32,
) -> RusTorchResult<QuantizedTensor<i8>>
fn quantize_static( &self, scale: f32, zero_point: i32, ) -> RusTorchResult<QuantizedTensor<i8>>
Source§fn can_quantize(&self) -> bool
fn can_quantize(&self) -> bool
Source§impl<T: Float + Clone + 'static> ZeroAllocShapeOps<T> for Tensor<T>
impl<T: Float + Clone + 'static> ZeroAllocShapeOps<T> for Tensor<T>
Source§fn try_squeeze_view(&self) -> RusTorchResult<Tensor<T>>
fn try_squeeze_view(&self) -> RusTorchResult<Tensor<T>>
Source§fn try_unsqueeze_view(&self, dim: usize) -> RusTorchResult<Tensor<T>>
fn try_unsqueeze_view(&self, dim: usize) -> RusTorchResult<Tensor<T>>
Source§impl<T: Float + Clone + 'static + ScalarOperand> ZeroCopyOps<T> for Tensor<T>
impl<T: Float + Clone + 'static + ScalarOperand> ZeroCopyOps<T> for Tensor<T>
Source§fn inplace_add(&mut self, other: &Tensor<T>) -> RusTorchResult<()>
fn inplace_add(&mut self, other: &Tensor<T>) -> RusTorchResult<()>
Source§fn inplace_sub(&mut self, other: &Tensor<T>) -> RusTorchResult<()>
fn inplace_sub(&mut self, other: &Tensor<T>) -> RusTorchResult<()>
Source§fn inplace_mul(&mut self, other: &Tensor<T>) -> RusTorchResult<()>
fn inplace_mul(&mut self, other: &Tensor<T>) -> RusTorchResult<()>
Source§fn inplace_mul_scalar(&mut self, scalar: T)
fn inplace_mul_scalar(&mut self, scalar: T)
Source§fn inplace_add_scalar(&mut self, scalar: T)
fn inplace_add_scalar(&mut self, scalar: T)
Source§fn inplace_apply<F>(&mut self, f: F) -> RusTorchResult<()>
fn inplace_apply<F>(&mut self, f: F) -> RusTorchResult<()>
Source§fn slice_view(&self, ranges: &[Range<usize>]) -> RusTorchResult<Tensor<T>>
fn slice_view(&self, ranges: &[Range<usize>]) -> RusTorchResult<Tensor<T>>
Auto Trait Implementations§
impl<T> Freeze for Tensor<T>
impl<T> RefUnwindSafe for Tensor<T>where
T: RefUnwindSafe,
impl<T> Send for Tensor<T>where
T: Send,
impl<T> Sync for Tensor<T>where
T: Sync,
impl<T> Unpin for Tensor<T>
impl<T> UnwindSafe for Tensor<T>where
T: RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more