텐서모양

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