ผลงาน

โครงสร้างต่อไปนี้มีอยู่ทั่วโลก

  • การต่อสองลำดับที่มีองค์ประกอบประเภทเดียวกัน

    คำประกาศ

    public struct Concatenation<Base1: Sequence, Base2: Sequence>: Sequence
    where Base1.Element == Base2.Element
    extension Concatenation: Collection where Base1: Collection, Base2: Collection
    extension Concatenation: BidirectionalCollection
    where Base1: BidirectionalCollection, Base2: BidirectionalCollection
    extension Concatenation: RandomAccessCollection
    where Base1: RandomAccessCollection, Base2: RandomAccessCollection
  • มุมมองแบบหมุนไปยังคอลเลกชัน

    คำประกาศ

    public struct RotatedCollection<Base> : Collection where Base : Collection
    extension RotatedCollection: BidirectionalCollection
    where Base: BidirectionalCollection
    extension RotatedCollection: RandomAccessCollection
    where Base: RandomAccessCollection
  • คำประกาศ

    public struct AnyDifferentiable : Differentiable
  • ค่าอนุพันธ์ที่ถูกลบประเภท

    ประเภท AnyDerivative ส่งต่อการดำเนินการไปยังค่าอนุพันธ์ฐานพื้นฐานตามอำเภอใจที่สอดคล้องกับ Differentiable และ AdditiveArithmetic โดยซ่อนข้อมูลเฉพาะของค่าพื้นฐาน

    คำประกาศ

    @frozen
    public struct AnyDerivative : Differentiable & AdditiveArithmetic
  • อาร์เรย์หลายมิติขององค์ประกอบที่เป็นลักษณะทั่วไปของเวกเตอร์และเมทริกซ์ในมิติที่อาจสูงกว่า

    พารามิเตอร์ทั่วไป Scalar อธิบายประเภทของสเกลาร์ในเมตริกซ์ (เช่น Int32 , Float ฯลฯ )

    คำประกาศ

    @frozen
    public struct Tensor<Scalar> where Scalar : TensorFlowScalar
    extension Tensor: Collatable
    extension Tensor: CopyableToDevice
    extension Tensor: AnyTensor
    extension Tensor: ExpressibleByArrayLiteral
    extension Tensor: CustomStringConvertible
    extension Tensor: CustomPlaygroundDisplayConvertible
    extension Tensor: CustomReflectable
    extension Tensor: TensorProtocol
    extension Tensor: TensorGroup
    extension Tensor: ElementaryFunctions where Scalar: TensorFlowFloatingPoint
    extension Tensor: VectorProtocol where Scalar: TensorFlowFloatingPoint
    extension Tensor: Equatable where Scalar: Equatable
    extension Tensor: Mergeable where Scalar: TensorFlowFloatingPoint
    extension Tensor: Codable where Scalar: Codable
    extension Tensor: AdditiveArithmetic where Scalar: Numeric
    extension Tensor: PointwiseMultiplicative where Scalar: Numeric
    extension Tensor: Differentiable & EuclideanDifferentiable where Scalar: TensorFlowFloatingPoint
    extension Tensor: DifferentiableTensorProtocol
    where Scalar: TensorFlowFloatingPoint
  • ฟังก์ชันดึงกลับที่ดำเนินการย้ายการส่งสัญญาณเท Tensors สองตัว

    คำประกาศ

    public struct BroadcastingPullback
  • บริบทที่จัดเก็บข้อมูลบริบทภายในเธรดที่ใช้โดย API การเรียนรู้เชิงลึก เช่น เลเยอร์

    ใช้ Context.local เพื่อดึงข้อมูลบริบทภายในเธรดปัจจุบัน

    ตัวอย่าง:

    • ตั้งค่าขั้นตอนการเรียนรู้ปัจจุบันเป็นการฝึกอบรมเพื่อให้เลเยอร์เช่น BatchNorm คำนวณค่าเฉลี่ยและความแปรปรวนเมื่อนำไปใช้กับอินพุต
      Context.local.learningPhase = .training
    
    • ตั้งค่าขั้นตอนการเรียนรู้ปัจจุบันเป็นการอนุมาน เพื่อให้เลเยอร์เช่น Dropout จะไม่เลื่อนหน่วยออกไปเมื่อใช้กับอินพุต
      Context.local.learningPhase = .inference
    

    คำประกาศ

    public struct Context
  • ชั้นการบิดแบบ 1 มิติ (เช่น การบิดแบบขมับในอนุกรมเวลา)

    เลเยอร์นี้สร้างตัวกรองการบิดที่เชื่อมโยงกับอินพุตเลเยอร์เพื่อสร้างเทนเซอร์ของเอาท์พุต

    คำประกาศ

    @frozen
    public struct Conv1D<Scalar> : Layer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การบิดแบบ 2 มิติ (เช่น การบิดแบบเชิงพื้นที่เหนือรูปภาพ)

    เลเยอร์นี้สร้างตัวกรองการบิดที่เชื่อมโยงกับอินพุตเลเยอร์เพื่อสร้างเทนเซอร์ของเอาท์พุต

    คำประกาศ

    @frozen
    public struct Conv2D<Scalar> : Layer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การบิดแบบ 3 มิติสำหรับการบิดแบบเชิงพื้นที่/เชิงพื้นที่-ชั่วคราวบนรูปภาพ

    เลเยอร์นี้สร้างตัวกรองการบิดที่เชื่อมโยงกับอินพุตเลเยอร์เพื่อสร้างเทนเซอร์ของเอาท์พุต

    คำประกาศ

    @frozen
    public struct Conv3D<Scalar> : Layer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การโน้มน้าวใจแบบขนย้าย 1 มิติ (เช่น การโน้มน้าวขนแบบขนย้ายชั่วคราวเหนือรูปภาพ)

    เลเยอร์นี้สร้างตัวกรองการบิดที่สลับสับเปลี่ยนกับอินพุตเลเยอร์เพื่อสร้างเทนเซอร์ของเอาท์พุต

    คำประกาศ

    @frozen
    public struct TransposedConv1D<Scalar> : Layer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การบิดแบบขนย้ายแบบ 2 มิติ (เช่น การบิดแบบขนย้ายเชิงพื้นที่เหนือรูปภาพ)

    เลเยอร์นี้สร้างตัวกรองการบิดที่สลับสับเปลี่ยนกับอินพุตเลเยอร์เพื่อสร้างเทนเซอร์ของเอาท์พุต

    คำประกาศ

    @frozen
    public struct TransposedConv2D<Scalar> : Layer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การโน้มน้าวใจแบบขนย้ายสามมิติ (เช่น การโน้มน้าวขนย้ายเชิงพื้นที่เหนือรูปภาพ)

    เลเยอร์นี้สร้างตัวกรองการบิดที่สลับสับเปลี่ยนกับอินพุตเลเยอร์เพื่อสร้างเทนเซอร์ของเอาท์พุต

    คำประกาศ

    @frozen
    public struct TransposedConv3D<Scalar> : Layer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การบิดแบบเชิงลึก 2 มิติ

    เลเยอร์นี้สร้างตัวกรองการบิดแบบแยกส่วนได้ซึ่งเชื่อมโยงกับอินพุตเลเยอร์เพื่อสร้างเทนเซอร์ของเอาท์พุต

    คำประกาศ

    @frozen
    public struct DepthwiseConv2D<Scalar> : Layer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์สำหรับการเพิ่มช่องว่างภายในเป็นศูนย์ในมิติชั่วคราว

    คำประกาศ

    public struct ZeroPadding1D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์สำหรับเพิ่มช่องว่างภายในเป็นศูนย์ในมิติเชิงพื้นที่

    คำประกาศ

    public struct ZeroPadding2D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์สำหรับการเพิ่มช่องว่างภายในเป็นศูนย์ในมิติเชิงพื้นที่/เชิงพื้นที่-ชั่วคราว

    คำประกาศ

    public struct ZeroPadding3D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การบิดแบบแยกส่วนได้ 1 มิติ

    เลเยอร์นี้ทำการบิดแบบเชิงลึกซึ่งทำหน้าที่แยกกันบนช่องสัญญาณ ตามด้วยการบิดแบบจุดซึ่งผสมช่องสัญญาณ

    คำประกาศ

    @frozen
    public struct SeparableConv1D<Scalar> : Layer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การบิดแบบแยกได้ 2 มิติ

    เลเยอร์นี้ทำการบิดแบบเชิงลึกซึ่งทำหน้าที่แยกกันบนช่องสัญญาณ ตามด้วยการบิดแบบจุดซึ่งผสมช่องสัญญาณ

    คำประกาศ

    @frozen
    public struct SeparableConv2D<Scalar> : Layer where Scalar : TensorFlowFloatingPoint
  • เป็นชั้นที่เรียบ

    เลเยอร์ที่ราบเรียบจะทำให้อินพุตแบนลงเมื่อใช้โดยไม่กระทบต่อขนาดแบทช์

    คำประกาศ

    @frozen
    public struct Flatten<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • ปรับรูปร่างเลเยอร์

    คำประกาศ

    @frozen
    public struct Reshape<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์ที่ล้อมรอบฟังก์ชันหาอนุพันธ์แบบกำหนดเอง

    คำประกาศ

    public struct Function<Input, Output> : ParameterlessLayer where Input : Differentiable, Output : Differentiable
  • ค่าประเภทไดนามิก TensorFlow ที่สร้างได้จากประเภทที่สอดคล้องกับ TensorFlowScalar

    คำประกาศ

    public struct TensorDataType : Equatable
  • คำประกาศ

    @frozen
    public struct BFloat16
    extension BFloat16: TensorFlowScalar
    extension BFloat16: XLAScalarType
  • แสดงถึงชุดองค์ประกอบที่อาจมีขนาดใหญ่

    Dataset สามารถใช้เพื่อแสดงไปป์ไลน์อินพุตเป็นชุดของเทนเซอร์องค์ประกอบ

    คำประกาศ

    @available(*, deprecated, message: "Datasets will be removed in S4TF v0.10. Please use the new Batches API instead.")
    @frozen
    public struct Dataset<Element> where Element : TensorGroup
    extension Dataset: Sequence
  • ประเภทที่อนุญาตการวนซ้ำองค์ประกอบของชุดข้อมูล

    คำประกาศ

    @available(*, deprecated)
    @frozen
    public struct DatasetIterator<Element> where Element : TensorGroup
    extension DatasetIterator: IteratorProtocol
  • โครงสร้างที่มีลักษณะคล้ายทูเพิล 2 อันที่สอดคล้องกับ TensorGroup ซึ่งแสดงถึงทูเพิล 2 ประเภทที่สอดคล้องกับ TensorGroup

    คำประกาศ

    @frozen
    public struct Zip2TensorGroup<T, U> : TensorGroup where T : TensorGroup, U : TensorGroup
  • เลเยอร์โครงข่ายประสาทเทียมที่เชื่อมต่ออย่างหนาแน่น

    Dense ดำเนินการเปิดใช้งานการดำเนินการ activation(matmul(input, weight) + bias) โดยที่ weight คือเมทริกซ์น้ำหนัก bias คือเวกเตอร์อคติ และ activation เป็นฟังก์ชันการเปิดใช้งานตามองค์ประกอบ

    เลเยอร์นี้ยังรองรับเทนเซอร์น้ำหนัก 3 มิติที่มีเมทริกซ์อคติ 2 มิติ ในกรณีนี้ มิติแรกของทั้งสองจะถือเป็นขนาดแบทช์ที่สอดคล้องกับมิติแรกของ input และใช้ชุดตัวแปรของการดำเนินการ matmul(_:_:) ดังนั้นการใช้น้ำหนักและความลำเอียงที่แตกต่างกันสำหรับแต่ละองค์ประกอบ ในชุดอินพุต

    คำประกาศ

    @frozen
    public struct Dense<Scalar> : Layer where Scalar : TensorFlowFloatingPoint
  • อุปกรณ์ที่สามารถจัดสรร Tensor ได้

    คำประกาศ

    public struct Device
    extension Device: Equatable
    extension Device: CustomStringConvertible
  • เลเยอร์ออกกลางคัน

    การออกกลางคันประกอบด้วยการสุ่มตั้งค่าเศษส่วนของหน่วยอินพุตเป็น 0 ในการอัปเดตแต่ละครั้งในระหว่างเวลาการฝึกอบรม ซึ่งจะช่วยป้องกันการโอเวอร์ฟิต

    คำประกาศ

    @frozen
    public struct Dropout<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • GaussianNoise เพิ่มสัญญาณรบกวนที่สุ่มตัวอย่างจากการแจกแจงแบบปกติ

    สัญญาณรบกวนที่เพิ่มเข้ามาจะมีค่าเฉลี่ยเป็นศูนย์เสมอ แต่มีค่าเบี่ยงเบนมาตรฐานที่กำหนดค่าได้

    คำประกาศ

    public struct GaussianNoise<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • GaussianDropout จะคูณอินพุตกับสัญญาณรบกวนที่สุ่มตัวอย่างจากการแจกแจงแบบปกติด้วยค่าเฉลี่ย 1.0

    เนื่องจากนี่คือเลเยอร์การทำให้เป็นมาตรฐาน จึงใช้งานได้เฉพาะในช่วงเวลาการฝึกเท่านั้น ในระหว่างการอนุมาน GaussianDropout จะส่งผ่านอินพุตที่ไม่มีการแก้ไข

    คำประกาศ

    public struct GaussianDropout<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การออกกลางคันของอัลฟ่า

    Alpha Dropout คือ Dropout ที่จะเก็บค่าเฉลี่ยและความแปรปรวนของอินพุตให้เป็นค่าดั้งเดิม เพื่อให้แน่ใจว่าคุณสมบัติการทำให้เป็นมาตรฐานในตัวเองแม้หลังจากการออกกลางคันนี้ Alpha Dropout เข้ากันได้ดีกับ Scaled Exponential Linear Units โดยการสุ่มตั้งค่าการเปิดใช้งานให้เป็นค่าความอิ่มตัวที่เป็นลบ

    ที่มา: โครงข่ายประสาทเทียมที่ทำให้เป็นมาตรฐานด้วยตนเอง: https://arxiv.org/abs/1706.02515

    คำประกาศ

    @frozen
    public struct AlphaDropout<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การฝัง

    Embedding เป็นตารางค้นหาที่มีประสิทธิภาพซึ่งแมปดัชนีจากคำศัพท์คงที่ไปจนถึงการแสดงเวกเตอร์ที่มีขนาดคงที่ (หนาแน่น) เช่น [[0], [3]] -> [[0.25, 0.1], [0.6, -0.2]]

    คำประกาศ

    public struct Embedding<Scalar> : Module where Scalar : TensorFlowFloatingPoint
  • โครงสร้างว่างที่แสดงถึง TangentVector ที่ว่างเปล่าสำหรับเลเยอร์ที่ไม่มีพารามิเตอร์

    คำประกาศ

  • คู่ของช่วงเวลาที่หนึ่งและวินาที (เช่น ค่าเฉลี่ยและความแปรปรวน)

    บันทึก

    สิ่งนี้จำเป็นเนื่องจากประเภททูเพิลไม่สามารถหาอนุพันธ์ได้

    คำประกาศ

    public struct Moments<Scalar> : Differentiable where Scalar : TensorFlowFloatingPoint
  • ชั้นการขยายทางสัณฐานวิทยา 2 มิติ

    เลเยอร์นี้ส่งคืนการขยายทางสัณฐานวิทยาของเทนเซอร์อินพุตด้วยตัวกรองที่ให้มา

    คำประกาศ

    @frozen
    public struct Dilation2D<Scalar> : Layer where Scalar : TensorFlowFloatingPoint
  • ชั้นการกัดเซาะทางสัณฐานวิทยา 2 มิติ

    เลเยอร์นี้จะคืนค่าการพังทลายทางสัณฐานวิทยาของเทนเซอร์อินพุตด้วยตัวกรองที่ให้มา

    คำประกาศ

    @frozen
    public struct Erosion2D<Scalar> : Layer where Scalar : TensorFlowFloatingPoint
  • การเลือกองค์ประกอบอย่างเกียจคร้าน ตามลำดับที่กำหนด จากคอลเลกชันฐานบางส่วน

    คำประกาศ

    public struct Sampling<Base: Collection, Selection: Collection>
    where Selection.Element == Base.Index
    extension Sampling: SamplingProtocol
    extension Sampling: Collection
    extension Sampling: BidirectionalCollection
      where Selection: BidirectionalCollection
    extension Sampling: RandomAccessCollection
      where Selection: RandomAccessCollection
  • คอลเลกชันของส่วนที่ต่อเนื่องกันซึ่งไม่ทับซ้อนกันที่ยาวที่สุดของคอลเลก Base บางส่วน เริ่มต้นด้วยองค์ประกอบแรก และมีความยาวสูงสุดคงที่

    องค์ประกอบของคอลเลกชั่นนี้ ยกเว้นชิ้นสุดท้าย ทั้งหมดจะมี count batchSize ยกเว้นว่า Base.count % batchSize !=0 ซึ่งในกรณีนี้ count ของแบตช์สุดท้ายคือ base.count % batchSize.

    คำประกาศ

    public struct Slices<Base> where Base : Collection
    extension Slices: Collection
  • เลเยอร์การทำให้เป็นมาตรฐานแบบแบตช์

    ทำให้การเปิดใช้งานของเลเยอร์ก่อนหน้าเป็นมาตรฐานในแต่ละชุด เช่น ใช้การเปลี่ยนแปลงที่รักษาค่าเฉลี่ยการเปิดใช้งานไว้ใกล้กับ 0 และค่าเบี่ยงเบนมาตรฐานการเปิดใช้งานใกล้กับ 1

    ข้อมูลอ้างอิง: การทำให้เป็นมาตรฐานแบบแบตช์: การเร่งการฝึกอบรมเครือข่ายเชิงลึกโดยการลดการเปลี่ยนแปลงโควาเรียตภายใน

    คำประกาศ

    @frozen
    public struct BatchNorm<Scalar> : Layer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์ที่ใช้การทำให้เป็นมาตรฐานของเลเยอร์บนอินพุตชุดย่อย

    อ้างอิง: การทำให้เลเยอร์เป็นมาตรฐาน

    คำประกาศ

    @frozen
    public struct LayerNorm<Scalar> : Layer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์ที่ใช้การทำให้เป็นมาตรฐานแบบกลุ่มกับอินพุตชุดย่อย

    อ้างอิง: การทำให้เป็นมาตรฐานของกลุ่ม

    คำประกาศ

    @frozen
    public struct GroupNorm<Scalar> : Layer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์ที่ใช้การทำให้อินสแตนซ์เป็นมาตรฐานกับอินพุตชุดย่อย

    การอ้างอิง: การทำให้อินสแตนซ์เป็นมาตรฐาน: ส่วนผสมที่ขาดหายไปสำหรับการปรับสไตล์อย่างรวดเร็ว

    คำประกาศ

    @frozen
    public struct InstanceNorm<Scalar> : Layer where Scalar : TensorFlowFloatingPoint
  • ระบุขั้นตอนเดียวของน้ำหนักเดียวภายในเครื่องมือเพิ่มประสิทธิภาพ

    คำประกาศ

    public struct OptimizerWeightStepState
  • สถานะสากลเข้าถึงได้ผ่าน StateAccessor

    คำประกาศ

    public struct OptimizerState
  • [String: Float] แต่องค์ประกอบต่างๆ สามารถเข้าถึงได้เหมือนกับเป็นสมาชิก

    คำประกาศ

    @dynamicMemberLookup
    public struct HyperparameterDictionary
  • เครื่องมือเพิ่มประสิทธิภาพที่ทำงานในกลุ่มพารามิเตอร์เดียว

    คำประกาศ

    public struct ParameterGroupOptimizer
  • Wrapper ที่ปลอดภัยสำหรับประเภทรอบๆ ค่าดัชนี Int สำหรับค่าท้องถิ่นของเครื่องมือเพิ่มประสิทธิภาพ

    คำประกาศ

    public struct LocalAccessor
  • Wrapper ที่ปลอดภัยสำหรับประเภทรอบๆ ค่าดัชนี Int สำหรับค่าส่วนกลางของเครื่องมือเพิ่มประสิทธิภาพ

    คำประกาศ

    public struct GlobalAccessor
  • Wrapper แบบปลอดภัยรอบๆ ค่าดัชนี Int สำหรับค่าสถานะของเครื่องมือเพิ่มประสิทธิภาพ

    คำประกาศ

    public struct StateAccessor
  • สร้าง ParameterGroupOptimizer ซึ่งใช้ในระดับน้ำหนักเดียวในแบบจำลอง การแม็ปจากกลุ่มพารามิเตอร์ที่เลือกโดย ( [Bool] ถึง parameterGroupOptimizer) จะกำหนดการเพิ่มประสิทธิภาพขั้นสุดท้าย

    คำประกาศ

    public struct ParameterGroupOptimizerBuilder
  • เลเยอร์การรวมสูงสุดสำหรับข้อมูลชั่วคราว

    คำประกาศ

    @frozen
    public struct MaxPool1D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การรวมกลุ่มสูงสุดสำหรับข้อมูลเชิงพื้นที่

    คำประกาศ

    @frozen
    public struct MaxPool2D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การรวมกลุ่มสูงสุดสำหรับข้อมูลเชิงพื้นที่หรือเชิงพื้นที่-ชั่วคราว

    คำประกาศ

    @frozen
    public struct MaxPool3D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การรวมเฉลี่ยสำหรับข้อมูลชั่วคราว

    คำประกาศ

    @frozen
    public struct AvgPool1D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การรวมกลุ่มโดยเฉลี่ยสำหรับข้อมูลเชิงพื้นที่

    คำประกาศ

    @frozen
    public struct AvgPool2D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การรวมกลุ่มโดยเฉลี่ยสำหรับข้อมูลเชิงพื้นที่หรือเชิงพื้นที่-ชั่วคราว

    คำประกาศ

    @frozen
    public struct AvgPool3D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การรวมกลุ่มเฉลี่ยทั่วโลกสำหรับข้อมูลชั่วคราว

    คำประกาศ

    @frozen
    public struct GlobalAvgPool1D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การรวมกลุ่มเฉลี่ยทั่วโลกสำหรับข้อมูลเชิงพื้นที่

    คำประกาศ

    @frozen
    public struct GlobalAvgPool2D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การรวมกลุ่มเฉลี่ยทั่วโลกสำหรับข้อมูลเชิงพื้นที่และเชิงพื้นที่-ชั่วคราว

    คำประกาศ

    @frozen
    public struct GlobalAvgPool3D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การรวมสูงสุดส่วนกลางสำหรับข้อมูลชั่วคราว

    คำประกาศ

    @frozen
    public struct GlobalMaxPool1D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การรวมสูงสุดทั่วโลกสำหรับข้อมูลเชิงพื้นที่

    คำประกาศ

    @frozen
    public struct GlobalMaxPool2D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การรวมสูงสุดทั่วโลกสำหรับข้อมูลเชิงพื้นที่และเชิงพื้นที่-ชั่วคราว

    คำประกาศ

    @frozen
    public struct GlobalMaxPool3D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์การรวมเศษส่วนสูงสุดสำหรับข้อมูลเชิงพื้นที่ หมายเหตุ: FractionalMaxPool ไม่มีการใช้งาน XLA และอาจมีผลกระทบต่อประสิทธิภาพการทำงาน

    คำประกาศ

    @frozen
    public struct FractionalMaxPool2D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • PythonObject แสดงถึงวัตถุใน Python และรองรับการค้นหาสมาชิกแบบไดนามิก การเข้าถึงของสมาชิกใดๆ เช่น object.foo จะร้องขอรันไทม์ Python แบบไดนามิกสำหรับสมาชิกที่มีชื่อที่ระบุในวัตถุนี้

    PythonObject ถูกส่งผ่านไปยังและส่งคืนจากการเรียกใช้ฟังก์ชัน Python และการอ้างอิงสมาชิกทั้งหมด รองรับเลขคณิต Python มาตรฐานและตัวดำเนินการเปรียบเทียบ

    ภายใน PythonObject ถูกนำมาใช้เป็นตัวชี้ที่นับการอ้างอิงไปยัง Python C API PyObject

    คำประกาศ

    @dynamicCallable
    @dynamicMemberLookup
    public struct PythonObject
    extension PythonObject : CustomStringConvertible
    extension PythonObject : CustomPlaygroundDisplayConvertible
    extension PythonObject : CustomReflectable
    extension PythonObject : PythonConvertible, ConvertibleFromPython
    extension PythonObject : SignedNumeric
    extension PythonObject : Strideable
    extension PythonObject : Equatable, Comparable
    extension PythonObject : Hashable
    extension PythonObject : Sequence
    extension PythonObject : MutableCollection
    extension PythonObject : ExpressibleByBooleanLiteral, ExpressibleByIntegerLiteral,
    ExpressibleByFloatLiteral, ExpressibleByStringLiteral
    extension PythonObject : ExpressibleByArrayLiteral, ExpressibleByDictionaryLiteral
  • wrapper PythonObject ที่เปิดใช้งานการเรียกใช้เมธอด Throw ข้อยกเว้นที่สร้างโดยฟังก์ชัน Python จะสะท้อนให้เห็นเป็นข้อผิดพลาดของ Swift และถูกส่งออกไป

    บันทึก

    มีเจตนาที่ ThrowingPythonObject ไม่มีแอตทริบิวต์ @dynamicCallable เนื่องจากไวยากรณ์การโทรไม่ใช้งานง่าย: x.throwing(arg1, arg2, ...) วิธีการจะยังคงได้รับการตั้งชื่อ dynamicallyCall จนกว่าจะมีการอภิปราย/ออกแบบเพิ่มเติม

    คำประกาศ

    public struct ThrowingPythonObject
  • Wrapper PythonObject ที่ช่วยให้สมาชิกเข้าถึงได้ การดำเนินการเข้าถึงสมาชิกส่งคืนผลลัพธ์ Optional เมื่อการเข้าถึงของสมาชิกล้มเหลว nil จะส่งคืนศูนย์

    คำประกาศ

    @dynamicMemberLookup
    public struct CheckingPythonObject
  • อินเทอร์เฟซสำหรับ Python

    PythonInterface อนุญาตให้โต้ตอบกับ Python สามารถใช้เพื่อนำเข้าโมดูลและเข้าถึงประเภทและฟังก์ชันในตัวของ Python แบบไดนามิก

    บันทึก

    ไม่ได้มีไว้สำหรับการเริ่มต้น PythonInterface โดยตรง โปรดใช้อินสแตนซ์ระดับโลกของ PythonInterface ชื่อ Python แทน

    คำประกาศ

    @dynamicMemberLookup
    public struct PythonInterface
  • คำประกาศ

    public struct PythonLibrary
  • เครื่องกำเนิดตัวเลขสุ่มชนิดลบ

    ประเภท AnyRandomNumberGenerator ส่งต่อการดำเนินการสร้างตัวเลขสุ่มไปยังตัวสร้างตัวเลขสุ่มที่ซ่อนอยู่ โดยซ่อนประเภทพื้นฐานเฉพาะของมัน

    คำประกาศ

    public struct AnyRandomNumberGenerator : RandomNumberGenerator
  • การใช้งาน SeedableRandomNumberGenerator โดยใช้ ARC4

    ARC4 เป็นรหัสสตรีมที่สร้างสตรีมไบต์แบบสุ่มหลอก PRNG นี้ใช้ seed เป็นกุญแจสำคัญ

    ARC4 ได้รับการอธิบายไว้ใน Schneier, B., “Applied Cryptography: Protocols, Algorithms, and Source Code in C”, ฉบับพิมพ์ครั้งที่ 2, 1996

    ตัวสร้างแต่ละตัวไม่ปลอดภัยสำหรับเธรด แต่ตัวสร้างที่แตกต่างกันจะไม่แชร์สถานะ ข้อมูลสุ่มที่สร้างขึ้นมีคุณภาพสูง แต่ไม่เหมาะสำหรับแอปพลิเคชันการเข้ารหัส

    คำประกาศ

    @frozen
    public struct ARC4RandomNumberGenerator : SeedableRandomNumberGenerator
  • การใช้งาน SeedableRandomNumberGenerator โดยใช้ Threefry ปลาแซลมอนและคณะ SC 2011. ตัวเลขสุ่มคู่ขนาน: ง่ายเหมือน 1, 2, 3 http://www.thesalmons.org/john/random123/papers/random123sc11.pdf

    โครงสร้างนี้ใช้ Threefry2x32 PRNG 20 รอบ จะต้องเริ่มต้นด้วยค่า 64 บิต

    ตัวสร้างแต่ละตัวไม่ปลอดภัยสำหรับเธรด แต่ตัวสร้างที่แตกต่างกันจะไม่แชร์สถานะ ข้อมูลสุ่มที่สร้างขึ้นมีคุณภาพสูง แต่ไม่เหมาะสำหรับแอปพลิเคชันการเข้ารหัส

    คำประกาศ

    public struct ThreefryRandomNumberGenerator : SeedableRandomNumberGenerator
  • การใช้งาน SeedableRandomNumberGenerator โดยใช้ Philox ปลาแซลมอนและคณะ SC 2011. ตัวเลขสุ่มคู่ขนาน: ง่ายเหมือน 1, 2, 3 http://www.thesalmons.org/john/random123/papers/random123sc11.pdf

    โครงสร้างนี้ใช้ Philox4x32 PRNG 10 รอบ จะต้องเริ่มต้นด้วยค่า 64 บิต

    ตัวสร้างแต่ละตัวไม่ปลอดภัยสำหรับเธรด แต่ตัวสร้างที่แตกต่างกันจะไม่แชร์สถานะ ข้อมูลสุ่มที่สร้างขึ้นมีคุณภาพสูง แต่ไม่เหมาะสำหรับแอปพลิเคชันการเข้ารหัส

    คำประกาศ

    public struct PhiloxRandomNumberGenerator : SeedableRandomNumberGenerator
  • คำประกาศ

    @frozen
    public struct UniformIntegerDistribution<T> : RandomDistribution where T : FixedWidthInteger
  • คำประกาศ

    @frozen
    public struct UniformFloatingPointDistribution<T: BinaryFloatingPoint>: RandomDistribution
    where T.RawSignificand: FixedWidthInteger
  • คำประกาศ

    @frozen
    public struct NormalDistribution<T: BinaryFloatingPoint>: RandomDistribution
    where T.RawSignificand: FixedWidthInteger
  • คำประกาศ

    @frozen
    public struct BetaDistribution : RandomDistribution
  • อินพุตไปยังโครงข่ายประสาทที่เกิดซ้ำ

    คำประกาศ

    public struct RNNCellInput<Input, State> : Differentiable where Input : Differentiable, State : Differentiable
    extension RNNCellInput: EuclideanDifferentiable
    where Input: EuclideanDifferentiable, State: EuclideanDifferentiable
  • เอาต์พุตไปยังโครงข่ายประสาทเทียมที่เกิดซ้ำ

    คำประกาศ

    public struct RNNCellOutput<Output, State> : Differentiable where Output : Differentiable, State : Differentiable
    extension RNNCellOutput: EuclideanDifferentiable
    where Output: EuclideanDifferentiable, State: EuclideanDifferentiable
  • เซลล์ RNN พื้นฐาน

    คำประกาศ

    public struct BasicRNNCell<Scalar> : RecurrentLayerCell where Scalar : TensorFlowFloatingPoint
  • เซลล์ LSTM

    คำประกาศ

    public struct LSTMCell<Scalar> : RecurrentLayerCell where Scalar : TensorFlowFloatingPoint
  • เซลล์ GRU

    คำประกาศ

    public struct GRUCell<Scalar> : RecurrentLayerCell where Scalar : TensorFlowFloatingPoint
  • คำประกาศ

    public struct RecurrentLayer<Cell> : Layer where Cell : RecurrentLayerCell
    extension RecurrentLayer: Equatable where Cell: Equatable
    extension RecurrentLayer: AdditiveArithmetic where Cell: AdditiveArithmetic
  • คำประกาศ

    public struct BidirectionalRecurrentLayer<Cell: RecurrentLayerCell>: Layer
    where Cell.TimeStepOutput: Mergeable
  • เลเยอร์ที่ประกอบขึ้นเป็นเลเยอร์อื่นตั้งแต่ 2 เลเยอร์ขึ้นไปตามลำดับ

    ตัวอย่าง:

    • สร้างโมเดล Perceptron 2 ชั้นอย่างง่ายสำหรับ MNIST:
    let inputSize = 28 * 28
    let hiddenSize = 300
    var classifier = Sequential {
         Dense<Float>(inputSize: inputSize, outputSize: hiddenSize, activation: relu)
         Dense<Float>(inputSize: hiddenSize, outputSize: 3, activation: identity)
     }
    
    • สร้างตัวเข้ารหัสอัตโนมัติสำหรับ MNIST:
    var autoencoder = Sequential {
        // The encoder.
        Dense<Float>(inputSize: 28 * 28, outputSize: 128, activation: relu)
        Dense<Float>(inputSize: 128, outputSize: 64, activation: relu)
        Dense<Float>(inputSize: 64, outputSize: 12, activation: relu)
        Dense<Float>(inputSize: 12, outputSize: 3, activation: relu)
        // The decoder.
        Dense<Float>(inputSize: 3, outputSize: 12, activation: relu)
        Dense<Float>(inputSize: 12, outputSize: 64, activation: relu)
        Dense<Float>(inputSize: 64, outputSize: 128, activation: relu)
        Dense<Float>(inputSize: 128, outputSize: imageHeight * imageWidth, activation: tanh)
    }
    

    คำประกาศ

    public struct Sequential<Layer1: Module, Layer2: Layer>: Module
        where Layer1.Output == Layer2.Input,
              Layer1.TangentVector.VectorSpaceScalar == Layer2.TangentVector.VectorSpaceScalar
    extension Sequential: Layer where Layer1: Layer
  • คำประกาศ

    @_functionBuilder
    public struct LayerBuilder
  • ShapedArray เป็นอาร์เรย์หลายมิติ มีรูปร่างซึ่งมีประเภท [Int] และกำหนดขนาดอาร์เรย์ และใช้ TensorBuffer ภายในเป็นที่เก็บข้อมูล

    คำประกาศ

    @frozen
    public struct ShapedArray<Scalar> : _ShapedArrayProtocol
    extension ShapedArray: RandomAccessCollection, MutableCollection
    extension ShapedArray: CustomStringConvertible
    extension ShapedArray: CustomPlaygroundDisplayConvertible
    extension ShapedArray: CustomReflectable
    extension ShapedArray: ExpressibleByArrayLiteral where Scalar: TensorFlowScalar
    extension ShapedArray: Equatable where Scalar: Equatable
    extension ShapedArray: Hashable where Scalar: Hashable
    extension ShapedArray: Codable where Scalar: Codable
  • ส่วนที่ต่อเนื่องกันของ ShapedArray หรือ ShapedArraySlice

    ShapedArraySlice ช่วยให้ดำเนินการได้อย่างรวดเร็วและมีประสิทธิภาพกับสไลซ์ของอินสแตนซ์ ShapedArray ที่ต่อเนื่องกัน อินสแตนซ์ ShapedArraySlice ไม่มีพื้นที่เก็บข้อมูลของตัวเอง แต่จะให้มุมมองเกี่ยวกับการจัดเก็บฐาน ShapedArray แทน ShapedArraySlice สามารถแสดงสไลซ์ได้สองประเภท: อาร์เรย์องค์ประกอบและอาร์เรย์ย่อย

    อาร์เรย์องค์ประกอบเป็นองค์ประกอบย่อยของ ShapedArray โดยอันดับจะน้อยกว่าฐานหนึ่งรายการ ชิ้นส่วนอาร์เรย์องค์ประกอบได้มาโดยการจัดทำดัชนีอินสแตนซ์ ShapedArray ด้วยดัชนี Int32 เอกพจน์

    ตัวอย่างเช่น:

        var matrix = ShapedArray(shape: [2, 2], scalars: [0, 1, 2, 3])
        // `matrix` represents [[0, 1], [2, 3]].
    
        let element = matrix[0]
        // `element` is a `ShapedArraySlice` with shape [2]. It is an element
        // array, specifically the first element in `matrix`: [0, 1].
    
        matrix[1] = ShapedArraySlice(shape: [2], scalars: [4, 8])
        // The second element in `matrix` has been mutated.
        // `matrix` now represents [[0, 1, 4, 8]].
    

    อาร์เรย์ย่อยคือช่วงขององค์ประกอบที่ต่อเนื่องกันใน ShapedArray ลำดับของอาร์เรย์ย่อยจะเหมือนกับลำดับฐาน แต่มิตินำหน้าคือการนับช่วงชิ้น ชิ้นส่วนย่อยได้มาจากการสร้างดัชนี ShapedArray ด้วย Range<Int32> ที่แสดงถึงช่วงขององค์ประกอบ (ในมิตินำหน้า) เมธอดเช่น prefix(:) และ suffix(:) ที่จัดทำดัชนีภายในด้วยช่วงยังสร้างอาร์เรย์ย่อยด้วย

    ตัวอย่างเช่น:

        let zeros = ShapedArray(repeating: 0, shape: [3, 2])
        var matrix = ShapedArray(shape: [3, 2], scalars: Array(0..<6))
        // `zeros` represents [[0, 0], [0, 0], [0, 0]].
        // `matrix` represents [[0, 1], [2, 3], [4, 5]].
    
        let subarray = matrix.prefix(2)
        // `subarray` is a `ShapedArraySlice` with shape [2, 2]. It is a slice
        // of the first 2 elements in `matrix` and represents [[0, 1], [2, 3]].
    
        matrix[0..<2] = zeros.prefix(2)
        // The first 2 elements in `matrix` have been mutated.
        // `matrix` now represents [[0, 0], [0, 0], [4, 5]].
    

    คำประกาศ

    @frozen
    public struct ShapedArraySlice<Scalar> : _ShapedArrayProtocol
    extension ShapedArraySlice: RandomAccessCollection, MutableCollection
    extension ShapedArraySlice: CustomStringConvertible
    extension ShapedArraySlice: CustomPlaygroundDisplayConvertible
    extension ShapedArraySlice: CustomReflectable
    extension ShapedArraySlice: ExpressibleByArrayLiteral where Scalar: TensorFlowScalar
    extension ShapedArraySlice: Equatable where Scalar: Equatable
    extension ShapedArraySlice: Hashable where Scalar: Hashable
    extension ShapedArraySlice: Codable where Scalar: Codable
  • StringTensor เป็นอาร์เรย์หลายมิติที่มีองค์ประกอบเป็น String s

    คำประกาศ

    @frozen
    public struct StringTensor
    extension StringTensor: TensorGroup
  • TensorHandle เป็นประเภทที่ใช้โดย ops ประกอบด้วยประเภท Scalar ซึ่งคอมไพลเลอร์ภายในสามารถใช้เพื่อกำหนดประเภทข้อมูลของพารามิเตอร์เมื่อแยกออกมาเป็นโปรแกรมเทนเซอร์

    คำประกาศ

    public struct TensorHandle<Scalar> where Scalar : _TensorFlowDataTypeCompatible
    extension TensorHandle: TensorGroup
  • คำประกาศ

    public struct ResourceHandle
    extension ResourceHandle: TensorGroup
  • คำประกาศ

    public struct VariantHandle
    extension VariantHandle: TensorGroup
  • โครงสร้างที่แสดงรูปร่างของเทนเซอร์

    TensorShape เป็นกระดาษห่อบางๆ ล้อมรอบอาร์เรย์ของจำนวนเต็มที่แสดงมิติของรูปร่าง เทนเซอร์ทุกประเภทใช้ 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
  • TensorVisitorPlan ประมาณ [WritableKeyPath<Base, Tensor<Float>] แต่มีประสิทธิภาพมากกว่า สิ่งนี้มีประโยชน์สำหรับการเขียนเครื่องมือเพิ่มประสิทธิภาพทั่วไปที่ต้องการแมปกับการไล่ระดับสี น้ำหนักที่มีอยู่ และดัชนีที่สามารถใช้เพื่อค้นหาน้ำหนักที่เก็บไว้เสริม สิ่งนี้มีประสิทธิภาพมากกว่าเล็กน้อย (~ 2x) แต่อาจจะดีกว่าเพราะมันแลกกับค่าโสหุ้ยที่สูงขึ้นเล็กน้อย (การอ้างอิงตัวชี้เพิ่มเติม) โดยที่ไม่ต้องทำงาน O(deep_of_tree) ที่จำเป็นกับรายการธรรมดาเพื่อติดตาม KeyPath แต่ละรายการ

    คำประกาศ

    public struct TensorVisitorPlan<Base>
  • เลเยอร์อัปแซมปลิงสำหรับอินพุต 1-D

    คำประกาศ

    @frozen
    public struct UpSampling1D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์อัปแซมปลิงสำหรับอินพุต 2 มิติ

    คำประกาศ

    @frozen
    public struct UpSampling2D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • เลเยอร์อัปแซมปลิงสำหรับอินพุต 3 มิติ

    คำประกาศ

    @frozen
    public struct UpSampling3D<Scalar> : ParameterlessLayer where Scalar : TensorFlowFloatingPoint
  • รวบรวมตัวนับการทำนายที่ถูกต้องและผลรวมการสูญเสีย

    คำประกาศ

    public struct HostStatistics