Registration is open for TensorFlow Dev Summit 2020 Learn more

Array

extension Array : KeyPathIterable
public 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
  • 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