TensorShape

@frozen
public struct TensorShape : ExpressibleByArrayLiteral
extension TensorShape: Collection, MutableCollection
extension TensorShape: RandomAccessCollection
extension TensorShape: RangeReplaceableCollection
extension TensorShape: Equatable
extension TensorShape: Codable
extension TensorShape: CustomStringConvertible

מבנה המייצג צורה של טנזור.

TensorShape היא עטיפה דקה סביב מערך של מספרים שלמים המייצגים ממדי צורות. כל סוגי הטנסור משתמשים TensorShape כדי לייצג את צורתם.

  • מידות הצורה.

    הַצהָרָה

    public var dimensions: [Int]
  • אתחול עם מערך של ממדים. דרגת הטנזור היא אורך המערך.

    הַצהָרָה

    public init(_ dimensions: [Int])

    פרמטרים

    dimensions

    מידות הצורה.

  • אתחול עם אוסף של מידות. דרגת הטנזור היא אורך האוסף.

    הַצהָרָה

    public init<C>(_ dimensions: C) where C : Collection, C.Element == Int

    פרמטרים

    dimensions

    מידות הצורה.

  • אתחול עם מערך מילולי המייצג את ממדי הצורה. דרגת הטנזור היא מספר הממדים.

    הַצהָרָה

    public init(arrayLiteral elements: Int...)

    פרמטרים

    dimensions

    מידות הצורה.

  • אתחול עם אלמנטים וריאדיים המייצגים את ממדי הצורה. דרגת הטנזור היא מספר האלמנטים.

    הַצהָרָה

    public init(_ elements: Int...)

    פרמטרים

    dimensions

    מידות הצורה.

  • הַצהָרָה

    public init(repeating repeatedValue: Int, count: Int)
  • דרגת הצורה (כלומר מספר הממדים).

    הַצהָרָה

    public var rank: Int { get }
  • גודל הצורה כמערך מאוחסן ברציפות.

    הַצהָרָה

    public var contiguousSize: Int { get }
  • הַצהָרָה

    public typealias Element = Int
  • הַצהָרָה

    public typealias Index = Int
  • הַצהָרָה

    public typealias Indices = Range<Int>
  • דרגת הצורה (כלומר מספר הממדים).

    הַצהָרָה

    public var count: Int { get }
  • הַצהָרָה

    public var indices: Indices { get }
  • הַצהָרָה

    public var startIndex: Index { get }
  • הַצהָרָה

    public var endIndex: Index { get }
  • הַצהָרָה

    public func index(after i: Index) -> Index
  • גש לגודל הממד ה-i.

    הַצהָרָה

    public subscript(position: Index) -> Element { get set }

    פרמטרים

    position

    האינדקס של ממד.

  • גש לגודל הממד ה-i.

    הַצהָרָה

    public subscript(bounds: Range<Int>) -> TensorShape { get set }

    פרמטרים

    index

    האינדקס של ממד.

  • הַצהָרָה

    public func index(_ i: Int, offsetBy distance: Int) -> Int
  • הַצהָרָה

    public func distance(from start: Int, to end: Int) -> Int
  • הַצהָרָה

    public typealias SubSequence = `Self`
  • הַצהָרָה

    public init()
  • הַצהָרָה

    public mutating mutating func append(_ newElement: Element)
  • הַצהָרָה

    public mutating mutating func append(contentsOf newElements: TensorShape)
  • הַצהָרָה

    public mutating mutating func append<S>(contentsOf newElements: S) where S : Sequence, S.Element == TensorShape.Element
  • הַצהָרָה

    public mutating func replaceSubrange<C>(
      _ subrange: Range<Index>, with newElements: C
    ) where C: Collection, Element == C.Element
  • הַצהָרָה

    public static func == (lhs: TensorShape, rhs: TensorShape) -> Bool
  • הַצהָרָה

    public func encode(to encoder: Encoder) throws
  • הַצהָרָה

    public init(from decoder: Decoder) throws
  • הַצהָרָה

    public var description: String { get }