KeyPathIterable

public protocol KeyPathIterable : _KeyPathIterableBase

A type whose values provides custom key paths to properties or elements.

  • A type that can represent a collection of all key paths of this type.

    Declaration

    associatedtype AllKeyPaths: Collection
      where AllKeyPaths.Element == PartialKeyPath<Self>
  • A collection of all custom key paths of this value.

    Declaration

    var allKeyPaths: AllKeyPaths { get }
  • move(to:)

    Extension method

    Recursively copies all CopyableToDevice-conforming nested properties and elements to the given Device in-place.

    Declaration

    public mutating mutating func move(to device: Device)
  • init(copying:to:)

    Extension method

    Creates a copy of self with all CopyableToDevice-conforming nested properties and elements copied to the given Device.

    Declaration

    public init(copying other: Self, to device: Device)
  • crossReplicaSum(_:)

    Extension method

    Runs a cross replica sum over all of the tensors found through key path iteration.

    Declaration

    public mutating mutating func crossReplicaSum(_ scale: Double)
  • recursivelyAllKeyPaths

    Extension method

    An array of all custom key paths of this value and any custom key paths nested within each of what this value’s key paths refers to.

    Declaration

    var recursivelyAllKeyPaths: [PartialKeyPath<Self>] { get }
  • allKeyPaths(to:)

    Extension method

    Returns an array of all custom key paths of this value, to the specified type.

    Declaration

    func allKeyPaths<T>(to _: T.Type) -> [KeyPath<Self, T>]
  • recursivelyAllKeyPaths(to:)

    Extension method

    Returns an array of all custom key paths of this value and any custom key paths nested within each of what this value’s key paths refers to, to the specified type.

    Declaration

    func recursivelyAllKeyPaths<T>(to _: T.Type) -> [KeyPath<Self, T>]
  • allWritableKeyPaths(to:)

    Extension method

    Returns an array of all custom writable key paths of this value, to the specified type.

    Declaration

    func allWritableKeyPaths<T>(to _: T.Type) -> [WritableKeyPath<Self, T>]
  • Returns an array of all custom writable key paths of this value and any custom writable key paths nested within each of what this value’s key paths refers to, to the specified type.

    Declaration

    func recursivelyAllWritableKeyPaths<T>(
      to _: T.Type
    ) -> [WritableKeyPath<Self, T>]