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

update mnist for new layers api #109

Merged
merged 3 commits into from
Apr 19, 2019
Merged

Conversation

brettkoonce
Copy link
Contributor

@rxwei if this is the correct pattern, I can bang out the other ones!

MNIST/main.swift Outdated
@@ -64,7 +67,7 @@ struct Classifier: Layer {
var layer1b = Dense<Float>(inputSize: 128, outputSize: 10, activation: softmax)

@differentiable
func applied(to input: Tensor<Float>) -> Tensor<Float> {
public func call(_ input: Input) -> Output {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove public.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

MNIST/main.swift Outdated
@@ -83,7 +86,7 @@ let (images, numericLabels) = readMNIST(imagesFile: "train-images-idx3-ubyte",
let labels = Tensor<Float>(oneHotAtIndices: numericLabels, depth: 10)

var classifier = Classifier()
let optimizer = RMSProp<Classifier, Float>()
let optimizer = RMSProp(for:classifier)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let optimizer = RMSProp(for:classifier)
let optimizer = RMSProp(for: classifier)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it!

MNIST/main.swift Outdated
@@ -53,6 +53,9 @@ func readMNIST(imagesFile: String, labelsFile: String) -> (images: Tensor<Float>

/// A classifier.
struct Classifier: Layer {
public typealias Input = Tensor<Float>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove public everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@brettkoonce brettkoonce mentioned this pull request Apr 19, 2019
@rxwei rxwei merged commit a32fd58 into tensorflow:master Apr 19, 2019
pschuh pushed a commit to pschuh/swift-models that referenced this pull request Jul 30, 2019
Moves all of `stdlib/TensorFlow` from apple/swift.

Friend PR: swiftlang/swift#24452.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants