คำเตือน: โครงการนี้เลิกใช้แล้ว Swift สำหรับ TensorFlow เป็นการทดลองในแพลตฟอร์มรุ่นต่อไปสำหรับการเรียนรู้ของเครื่อง โดยรวมงานวิจัยล่าสุดเกี่ยวกับการเรียนรู้ของเครื่อง คอมไพเลอร์ การเขียนโปรแกรมสร้างความแตกต่าง การออกแบบระบบ และอื่นๆ ถูกเก็บถาวรในเดือนกุมภาพันธ์ 2564
ตามลำดับ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
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
เลเยอร์ที่ประกอบขึ้นเป็นเลเยอร์อื่นตั้งแต่ 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 var layer1: Layer1
คำประกาศ
public var layer2: Layer2
คำประกาศ
public init(_ layer1: Layer1, _ layer2: Layer2)
คำประกาศ
@differentiable(wrt: self)
public func callAsFunction(_ input: Layer1.Input) -> Layer2.Output
คำประกาศ
public init(@LayerBuilder layers: () -> `Self`)
มีจำหน่ายที่ `Layer1`: `Layer`
คำประกาศ
@differentiable
public func callAsFunction(_ input: Layer1.Input) -> Layer2.Output
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2023-12-01 UTC
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"ไม่มีข้อมูลที่ฉันต้องการ"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"ล้าสมัย"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"ปัญหาเกี่ยวกับการแปล"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"อื่นๆ"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"เข้าใจง่าย"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"แก้ปัญหาของฉันได้"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"อื่นๆ"
}]