テンソルシェイプ

@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 }