Collection

extension Collection where Element: DynamicGraph.AnyTensor
extension Collection where Element: DynamicGraph.AnyGroup
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>

Available where Element: DynamicGraph.AnyTensor

  • 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.

Available where Element: DynamicGraph.AnyGroup

  • 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.

Available where Element == Tensor<Float64>

Available where Element == Tensor<Int64>

Available where Element == Tensor<Float32>

Available where Element == Tensor<Int32>

Available where Element == Tensor<Float16>

Available where Element == Tensor<UInt8>