Array

extension Array: MutableCollectionAlgorithms
extension Array: KeyPathIterable
extension Array: Differentiable where Element: Differentiable
extension Array: EuclideanDifferentiable
where Element: EuclideanDifferentiable
extension Array where Element: Differentiable
extension Array : ConvertibleFromNumpyArray
where Element : NumpyScalarCompatible
public extension Array where Element : NumpyScalarCompatible
extension Array : PythonConvertible where Element : PythonConvertible
extension Array : ConvertibleFromPython where Element : ConvertibleFromPython
extension Array: ElementaryFunctions where Element: ElementaryFunctions
extension Array: TensorArrayProtocol where Element: TensorGroup
extension Array where Element == UInt8
extension Array where Element == Bool
extension Array where Element == Int64
extension Array where Element == XLATensor
extension Array where Element: AnyTensor
extension Array where Element == PaddingConfigDimension
  • Declaration

    @derivative
    init(repeating: count)
  • Declaration

    @differentiable(wrt: self)
    public func differentiableMap<Result: Differentiable>(
      _ body: @differentiable (Element) -> Result
    ) -> [Result]
  • Declaration

    @differentiable(wrt: (self, initialResult)
    public func differentiableReduce<Result: Differentiable>(
      _ initialResult: Result,
      _ nextPartialResult: @differentiable (Result, Element) -> Result
    ) -> Result
  • Creates an Array with the same shape and scalars as the specified numpy.ndarray instance.

    Precondition

    The numpy Python package must be installed.

    Declaration

    public init?(numpy numpyArray: PythonObject)

    Parameters

    numpyArray

    The numpy.ndarray instance to convert.

    Return Value

    numpyArray converted to an Array. Returns nil if numpyArray is not 1-D or does not have a compatible scalar dtype.

  • Creates a 1-D numpy.ndarray instance with the same scalars as this Array.

    Precondition

    The numpy Python package must be installed.

    Declaration

    func makeNumpyArray() -> PythonObject
  • The square root of x.

    For real types, if x is negative the result is .nan. For complex types there is a branch cut on the negative real axis.

    Declaration

    public static func sqrt(_ x: `Self`) -> Array<Element>
  • The cosine of x, interpreted as an angle in radians.

    Declaration

    public static func cos(_ x: `Self`) -> Array<Element>
  • The sine of x, interpreted as an angle in radians.

    Declaration

    public static func sin(_ x: `Self`) -> Array<Element>
  • The tangent of x, interpreted as an angle in radians.

    Declaration

    public static func tan(_ x: `Self`) -> Array<Element>
  • The inverse cosine of x in radians.

    Declaration

    public static func acos(_ x: `Self`) -> Array<Element>
  • The inverse sine of x in radians.

    Declaration

    public static func asin(_ x: `Self`) -> Array<Element>
  • The inverse tangent of x in radians.

    Declaration

    public static func atan(_ x: `Self`) -> Array<Element>
  • The hyperbolic cosine of x.

    Declaration

    public static func cosh(_ x: `Self`) -> Array<Element>
  • The hyperbolic sine of x.

    Declaration

    public static func sinh(_ x: `Self`) -> Array<Element>
  • The hyperbolic tangent of x.

    Declaration

    public static func tanh(_ x: `Self`) -> Array<Element>
  • The inverse hyperbolic cosine of x.

    Declaration

    public static func acosh(_ x: `Self`) -> Array<Element>
  • The inverse hyperbolic sine of x.

    Declaration

    public static func asinh(_ x: `Self`) -> Array<Element>
  • The inverse hyperbolic tangent of x.

    Declaration

    public static func atanh(_ x: `Self`) -> Array<Element>
  • The exponential function applied to x, or e**x.

    Declaration

    public static func exp(_ x: `Self`) -> Array<Element>
  • Two raised to to power x.

    Declaration

    public static func exp2(_ x: `Self`) -> Array<Element>
  • Ten raised to to power x.

    Declaration

    public static func exp10(_ x: `Self`) -> Array<Element>
  • exp(x) - 1 evaluated so as to preserve accuracy close to zero.

    Declaration

    public static func expm1(_ x: `Self`) -> Array<Element>
  • The natural logarithm of x.

    Declaration

    public static func log(_ x: `Self`) -> Array<Element>
  • The base-two logarithm of x.

    Declaration

    public static func log2(_ x: `Self`) -> Array<Element>
  • The base-ten logarithm of x.

    Declaration

    public static func log10(_ x: `Self`) -> Array<Element>
  • log(1 + x) evaluated so as to preserve accuracy close to zero.

    Declaration

    public static func log1p(_ x: `Self`) -> Array<Element>
  • exp(y log(x)) computed without loss of intermediate precision.

    For real types, if x is negative the result is NaN, even if y has an integral value. For complex types, there is a branch cut on the negative real axis.

    Declaration

    public static func pow(_ x: `Self`, _ y: `Self`) -> Array<Element>
  • x raised to the nth power.

    The product of n copies of x.

    Declaration

    public static func pow(_ x: `Self`, _ n: Int) -> Array<Element>
  • The nth root of x.

    For real types, if x is negative and n is even, the result is NaN. For complex types, there is a branch cut along the negative real axis.

    Declaration

    public static func root(_ x: `Self`, _ n: Int) -> Array<Element>
  • Declaration

    public init(_owning tensorHandles: UnsafePointer<CTensorHandle>?, count: Int)
  • Declaration

    public init<C: RandomAccessCollection>(
      _handles: C
    ) where C.Element: _AnyTensorHandle
  • Note

    The SHA1 hash is only 20 bytes long and so only the first 20 bytes of the returned SIMD32<UInt8> are non-zero.

    Declaration

    func sha1() -> SIMD32<UInt8>
  • Declaration

    func sha512() -> SIMD64<UInt8>
  • Computes a || b elementwise as though we were or-ing together two masks.

    Declaration

    public func mergingMask(with other: [Bool]) -> [Bool]
  • Declaration

    func withArrayRef<Result>(_ body: (Int64ArrayRef) throws -> Result) rethrows -> Result
  • Declaration

    func withArrayRef<Result>(_ body: (OpaqueXLATensorArrayRef) throws -> Result) rethrows -> Result
  • Declaration

    func withArrayRef<T, Result>(_ body: (OpaqueXLATensorArrayRef) throws -> Result) rethrows
      -> Result
    where Element == Tensor<T>
  • Declaration

    func withArrayRef<Result>(_ body: (inout PaddingConfig) -> Result) -> Result