Collection
extension Collection where Element: DynamicGraph.AnyTensor
extension Collection where Element: DynamicGraph.AnyGroup
extension Collection where Element: Optimizer
extension Collection where Element == Tensor<Float64>
extension Collection where Element == Tensor<Int64>
extension Collection where Element == Tensor<Float32>
extension Collection where Element == Tensor<Int32>
extension Collection where Element == Tensor<Float16>
extension Collection where Element == Tensor<UInt8>
-
Compute gradients from this tensor to the source tensors.
Declaration
Swift
public func backward<S: Sequence>(to tensors: S, streamContext: StreamContext? = nil) where S.Element: DynamicGraph.AnyTensor
Parameters
to
The source tensors to this tensor.
streamContext
The stream context to perform such operation.
-
Compute gradients from this tensor to the source tensor.
Declaration
Swift
public func backward(to tensor: DynamicGraph.AnyTensor, streamContext: StreamContext? = nil)
Parameters
to
The source tensor to this tensor.
streamContext
The stream context to perform such operation.
-
Compute gradients from this tensor to the source tensors.
Declaration
Swift
public func backward<S: Sequence>(to tensors: S, streamContext: StreamContext? = nil) where S.Element: DynamicGraph.AnyGroup
Parameters
to
The source tensors to this tensor.
streamContext
The stream context to perform such operation.
-
Compute gradients from this tensor to the source tensor.
Declaration
Swift
public func backward<Group: DynamicGraph.AnyGroup>( to tensor: Group, streamContext: StreamContext? = nil )
Parameters
to
The source tensor to this tensor.
streamContext
The stream context to perform such operation.
-
Update parameters together for a collection of optimizers.
Declaration
Swift
public func step(streamContext: StreamContext? = nil)
Parameters
streamContext
The stream context to have update operation on.
-
Undocumented
Declaration
Swift
public func reshape( format: TensorFormat, dimensions: [Int], offset: [Int]? = nil, increments: [Int]? = nil ) -> [Element]
-
Create new tensors pointing to the same memory region but with different sizes.
Declaration
Swift
public func reshape( _ dimensionFormat: TensorDimensionFormat, offset: [Int]? = nil, increments: [Int]? = nil ) -> [Element]
Parameters
dimensionFormat
New format and dimensions for the tensor.
offset
Whether offset on each dimensions.
increments
The step on each dimensions.
Return Value
The new tensors with different format but the same memory content.
-
Undocumented
Declaration
Swift
public func reshape( format: TensorFormat, dimensions: [Int], offset: [Int]? = nil, increments: [Int]? = nil ) -> [Element]
-
Create new tensors pointing to the same memory region but with different sizes.
Declaration
Swift
public func reshape( _ dimensionFormat: TensorDimensionFormat, offset: [Int]? = nil, increments: [Int]? = nil ) -> [Element]
Parameters
dimensionFormat
New format and dimensions for the tensor.
offset
Whether offset on each dimensions.
increments
The step on each dimensions.
Return Value
The new tensors with different format but the same memory content.
-
Undocumented
Declaration
Swift
public func reshape( format: TensorFormat, dimensions: [Int], offset: [Int]? = nil, increments: [Int]? = nil ) -> [Element]
-
Create new tensors pointing to the same memory region but with different sizes.
Declaration
Swift
public func reshape( _ dimensionFormat: TensorDimensionFormat, offset: [Int]? = nil, increments: [Int]? = nil ) -> [Element]
Parameters
dimensionFormat
New format and dimensions for the tensor.
offset
Whether offset on each dimensions.
increments
The step on each dimensions.
Return Value
The new tensors with different format but the same memory content.
-
Undocumented
Declaration
Swift
public func reshape( format: TensorFormat, dimensions: [Int], offset: [Int]? = nil, increments: [Int]? = nil ) -> [Element]
-
Create new tensors pointing to the same memory region but with different sizes.
Declaration
Swift
public func reshape( _ dimensionFormat: TensorDimensionFormat, offset: [Int]? = nil, increments: [Int]? = nil ) -> [Element]
Parameters
dimensionFormat
New format and dimensions for the tensor.
offset
Whether offset on each dimensions.
increments
The step on each dimensions.
Return Value
The new tensors with different format but the same memory content.
-
Undocumented
Declaration
Swift
public func reshape( format: TensorFormat, dimensions: [Int], offset: [Int]? = nil, increments: [Int]? = nil ) -> [Element]
-
Create new tensors pointing to the same memory region but with different sizes.
Declaration
Swift
public func reshape( _ dimensionFormat: TensorDimensionFormat, offset: [Int]? = nil, increments: [Int]? = nil ) -> [Element]
Parameters
dimensionFormat
New format and dimensions for the tensor.
offset
Whether offset on each dimensions.
increments
The step on each dimensions.
Return Value
The new tensors with different format but the same memory content.
-
Undocumented
Declaration
Swift
public func reshape( format: TensorFormat, dimensions: [Int], offset: [Int]? = nil, increments: [Int]? = nil ) -> [Element]
-
Create new tensors pointing to the same memory region but with different sizes.
Declaration
Swift
public func reshape( _ dimensionFormat: TensorDimensionFormat, offset: [Int]? = nil, increments: [Int]? = nil ) -> [Element]
Parameters
dimensionFormat
New format and dimensions for the tensor.
offset
Whether offset on each dimensions.
increments
The step on each dimensions.
Return Value
The new tensors with different format but the same memory content.