The following functions are available globally.

  • Computes sigmoid of the specified tensor element-wise. Specifically, computes 1 / (1 + exp(-x)).

    Declaration

    public func sigmoid<T>(_ x: Tensor<T>) -> Tensor<T> where T : BinaryFloatingPoint, T : AccelerableByTensorFlow
  • Computes relu of the specified tensor element-wise. Specifically, computes max(0, x).

    Declaration

    public func relu<T>(_ x: Tensor<T>) -> Tensor<T> where T : BinaryFloatingPoint, T : AccelerableByTensorFlow
  • Computes the softmax of the specified tensor element-wise. Specifically, computes exp(x) / exp(x).sum().

    Declaration

    public func softmax<T>(_ x: Tensor<T>) -> Tensor<T> where T : BinaryFloatingPoint, T : AccelerableByTensorFlow
  • Computes the softmax of the specified tensor along the specified axis. Specifically, computes exp(x) / exp(x).sum(alongAxes: axis).

    Declaration

    public func softmax<T : BinaryFloatingPoint>(
      _ x: Tensor<T>, alongAxis axis: Int32
    ) -> Tensor<T>
  • Computes the absolute value of the specified tensor element-wise.

    Declaration

    public func abs<T>(_ x: Tensor<T>) -> Tensor<T> where T : SignedNumeric, T : AccelerableByTensorFlow
  • Computes the natural logarithm of the specified tensor element-wise.

    Declaration

    public func log<T>(_ x: Tensor<T>) -> Tensor<T> where T : BinaryFloatingPoint, T : AccelerableByTensorFlow
  • Computes sin of the specified tensor element-wise.

    Declaration

    public func sin<T>(_ x: Tensor<T>) -> Tensor<T> where T : BinaryFloatingPoint, T : AccelerableByTensorFlow
  • Computes cos of the specified tensor element-wise.

    Declaration

    public func cos<T>(_ x: Tensor<T>) -> Tensor<T> where T : BinaryFloatingPoint, T : AccelerableByTensorFlow
  • Computes cos of the specified tensor element-wise.

    Declaration

    public func tan<T>(_ x: Tensor<T>) -> Tensor<T> where T : BinaryFloatingPoint, T : AccelerableByTensorFlow
  • Computes cos of the specified tensor element-wise.

    Declaration

    public func sinh<T>(_ x: Tensor<T>) -> Tensor<T> where T : BinaryFloatingPoint, T : AccelerableByTensorFlow
  • Computes cos of the specified tensor element-wise.

    Declaration

    public func cosh<T>(_ x: Tensor<T>) -> Tensor<T> where T : BinaryFloatingPoint, T : AccelerableByTensorFlow
  • Computes cos of the specified tensor element-wise.

    Declaration

    public func tanh<T>(_ x: Tensor<T>) -> Tensor<T> where T : BinaryFloatingPoint, T : AccelerableByTensorFlow
  • Computes the square root of the specified tensor element-wise.

    Declaration

    public func sqrt<T>(_ x: Tensor<T>) -> Tensor<T> where T : BinaryFloatingPoint, T : AccelerableByTensorFlow
  • Computes the inverse square root of the specified tensor element-wise.

    Declaration

    public func rsqrt<T>(_ x: Tensor<T>) -> Tensor<T> where T : BinaryFloatingPoint, T : AccelerableByTensorFlow
  • Computes exp of the specified tensor element-wise.

    Declaration

    public func exp<T>(_ x: Tensor<T>) -> Tensor<T> where T : BinaryFloatingPoint, T : AccelerableByTensorFlow
  • Computes the power of the first tensor to the second tensor.

    Declaration

    public func pow<T>(_ lhs: Tensor<T>, _ rhs: Tensor<T>) -> Tensor<T>
      where T : BinaryFloatingPoint
  • Computes the power of the scalar to the tensor, broadcasting the scalar.

    Declaration

    public func pow<T>(_ lhs: T, _ rhs: Tensor<T>) -> Tensor<T>
      where T : BinaryFloatingPoint
  • Computes the power of the tensor to the scalar, broadcasting the scalar.

    Declaration

    public func pow<T>(_ lhs: Tensor<T>, _ rhs: T) -> Tensor<T>
      where T : BinaryFloatingPoint
  • Computes the element-wise maximum of two tensors.

    Note

    max supports broadcasting.

    Declaration

    public func max<T>(_ lhs: Tensor<T>, _ rhs: Tensor<T>) -> Tensor<T>
      where T : Numeric & Comparable
  • Computes the element-wise maximum of the scalar and the tensor, broadcasting the scalar.

    Declaration

    public func max<T>(_ lhs: T, _ rhs: Tensor<T>) -> Tensor<T>
      where T : Numeric & Comparable
  • Computes the element-wise maximum of the scalar and the tensor, broadcasting the scalar.

    Declaration

    public func max<T>(_ lhs: Tensor<T>, _ rhs: T) -> Tensor<T>
      where T : Numeric & Comparable
  • Computes the element-wise minimum of two tensors.

    Note

    min supports broadcasting.

    Declaration

    public func min<T>(_ lhs: Tensor<T>, _ rhs: Tensor<T>) -> Tensor<T>
      where T : Numeric & Comparable
  • Computes the element-wise minimum of the scalar and the tensor, broadcasting the scalar.

    Declaration

    public func min<T>(_ lhs: T, _ rhs: Tensor<T>) -> Tensor<T>
      where T : Numeric & Comparable
  • Computes the element-wise minimum of the scalar and the tensor, broadcasting the scalar.

    Declaration

    public func min<T>(_ lhs: Tensor<T>, _ rhs: T) -> Tensor<T>
      where T : Numeric & Comparable
  • Computes the log-softmax of the specified tensor element-wise.

    Declaration

    public func logSoftmax<T>(_ x: Tensor<T>) -> Tensor<T> where T : BinaryFloatingPoint, T : AccelerableByTensorFlow