Skip to content
This repository was archived by the owner on Apr 23, 2025. It is now read-only.

Remove deprecated allDifferentiableVariables #194

Merged
merged 1 commit into from
Aug 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Autoencoder/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ for epoch in 1...epochCount {
return meanSquaredError(predicted: image, expected: x)
}

optimizer.update(&autoencoder.allDifferentiableVariables, along: 𝛁model)
optimizer.update(&autoencoder, along: 𝛁model)
}
}
2 changes: 1 addition & 1 deletion Catch/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ extension CatchAgent {

let 𝛁loss = -log(Tensor<Float>(ŷ.max())).broadcasted(like: ŷ) * previousReward
let (𝛁model, _) = backprop(𝛁loss)
optimizer.update(&model.allDifferentiableVariables, along: 𝛁model)
optimizer.update(&model, along: 𝛁model)

return CatchAction(rawValue: Int(maxIndex))!
}
Expand Down
2 changes: 1 addition & 1 deletion Examples/Custom-CIFAR10/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ for epoch in 1...100 {
}
trainingLossSum += loss.scalarized()
trainingBatchCount += 1
optimizer.update(&model.allDifferentiableVariables, along: gradients)
optimizer.update(&model, along: gradients)
}

var testLossSum: Float = 0
Expand Down
2 changes: 1 addition & 1 deletion Examples/LeNet-MNIST/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ for epoch in 1...epochCount {
return loss
}
// Update the model's differentiable variables along the gradient vector.
optimizer.update(&classifier.allDifferentiableVariables, along: 𝛁model)
optimizer.update(&classifier, along: 𝛁model)
}

Context.local.learningPhase = .inference
Expand Down
2 changes: 1 addition & 1 deletion Examples/ResNet-CIFAR10/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ for epoch in 1...10 {
}
trainingLossSum += loss.scalarized()
trainingBatchCount += 1
optimizer.update(&model.allDifferentiableVariables, along: gradients)
optimizer.update(&model, along: gradients)
}
var testLossSum: Float = 0
var testBatchCount = 0
Expand Down
4 changes: 2 additions & 2 deletions GAN/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ for epoch in 1...epochCount {
let loss = generatorLoss(fakeLogits: fakeLogits)
return loss
}
optG.update(&generator.allDifferentiableVariables, along: 𝛁generator)
optG.update(&generator, along: 𝛁generator)

// Update discriminator.
let realImages = dataset.trainingImages.minibatch(at: i, batchSize: batchSize)
Expand All @@ -167,7 +167,7 @@ for epoch in 1...epochCount {
let loss = discriminatorLoss(realLogits: realLogits, fakeLogits: fakeLogits)
return loss
}
optD.update(&discriminator.allDifferentiableVariables, along: 𝛁discriminator)
optD.update(&discriminator, along: 𝛁discriminator)
}

// Start inference phase.
Expand Down
2 changes: 1 addition & 1 deletion Gym/CartPole/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ while true {
return loss
}
}
optimizer.update(&net.allDifferentiableVariables, along: gradients)
optimizer.update(&net, along: gradients)

print("It has episode count \(episodeCount) and mean reward \(meanReward)")

Expand Down