ML Community Day is November 9! Join us for updates from TensorFlow, JAX, and more Learn more

Mergeable

public protocol Mergeable : AdditiveArithmetic, Differentiable

A type with values that support differentiable binary operations.

Used by BidirectionalRecurrentLayer as a generic requirement for merge functions.

  • Concatenates two values.

    Declaration

    @differentiable
    static func concatenate(_ lhs: Self, _ rhs: Self) -> Self
  • Adds two values and produces their sum.

    Note

    renaming sum to + results in a compiler crash when conforming Tensor to Mergeable (SR-13229).

    Declaration

    @differentiable
    static func sum(_ lhs: Self, _ rhs: Self) -> Self
  • Averages two values.

    Declaration

    @differentiable
    static func average(_ lhs: Self, _ rhs: Self) -> Self
  • Multiplies two values.

    Declaration

    @differentiable
    static func multiply(_ lhs: Self, _ rhs: Self) -> Self
  • Stack two values.

    Declaration

    @differentiable
    static func stack(_ lhs: Self, _ rhs: Self) -> Self