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

Conversation

@t-ae
Copy link
Contributor

@t-ae t-ae commented Jul 25, 2019

Related issue: #150

Added (non-convolutional) GAN example on MNIST.

After 10 epochs of training, output is like this:
epoch-10-output

@rxwei rxwei requested a review from BradLarson July 25, 2019 02:02
@rxwei rxwei requested review from dan-zheng and rxwei July 25, 2019 03:09
@t-ae
Copy link
Contributor Author

t-ae commented Jul 25, 2019

By the way I couldn't pass leakyRelu to Denses directly.

error: generic parameter 'T' could not be inferred
    var dense1 = Dense<Float>(inputSize: latentDim, outputSize: latentDim*2, activation: leakyRelu)

So I had to use wrapper.

func lrelu(x: Tensor<Float>) -> Tensor<Float> {
leakyRelu(x)
}

var dense1 = Dense<Float>(inputSize: latentDim, outputSize: latentDim*2, activation: lrelu)

It seems this old bug is related.
https://bugs.swift.org/browse/SR-504

I think it's good to have separate implementation of func leakyRelu<T: TensorFlowFloatingPoint>(_ x: Tensor<T>) -> Tensor<T> in swift-apis until the bug is resolved.

@t-ae
Copy link
Contributor Author

t-ae commented Jul 26, 2019

There was another disgrace inherited from autoencoder example.
It loads labels but uses its size only.

I totally removed labels in this commit.
e52b0ec

I'll create another PR for autoencoder if this change is accepted.

)
}

// Models
Copy link
Contributor

Choose a reason for hiding this comment

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

Add an empty line, since this is describing both Generator and Discriminator below.

Suggested change
// Models
// Models

}
}

// Loss functions
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
// Loss functions
// Loss functions

GAN/main.swift Outdated
// Inference phase
Context.local.learningPhase = .inference
let testImage: Tensor<Float> = generator(testVector)

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove redundant empty line.

GAN/main.swift Outdated
plotTestImage(testImage, name: "epoch-\(epoch)-output")

let lossG = generatorLossFunc(fakeLogits: testImage)

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove redundant empty line.

GAN/main.swift Outdated
let loss = discriminatorLossFunc(realLogits: realLogits, fakeLogits: fakeLogits)
return loss
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove redundant empty line.

GAN/main.swift Outdated
// Training phase
Context.local.learningPhase = .training
for i in 0 ..< Int(labels.shape[0]) / batchSize {
// Alternative update
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
// Alternative update
// Perform alternative update.

GAN/main.swift Outdated
Context.local.learningPhase = .training
for i in 0 ..< Int(labels.shape[0]) / batchSize {
// Alternative update

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

@BradLarson
Copy link
Contributor

@t-ae - I wouldn't worry too much about any issues with MNIST loading here or in the Autoencoder example, because I'm in the process of extracting datasets to be separate from the models anyway and much of this code will be removed and consolidated in a central location. Once you have the last few things resolved here, I can handle the Autoencoder and its MNIST inputs.

GAN/main.swift Outdated
func plotTestImage(_ testImage: Tensor<Float>, name: String) {
var imageGrid = testImage.reshaped(to: [testImageGridSize, testImageGridSize,
imageHeight, imageWidth])

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove redundant empty line.

GAN/main.swift Outdated
imageGrid = imageGrid.transposed(withPermutations: [0, 2, 1, 3])
imageGrid = imageGrid.reshaped(to: [(imageHeight+2)*testImageGridSize,
(imageWidth+2)*testImageGridSize])

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove redundant empty line.

GAN/main.swift Outdated

// Transpose to create single image.
imageGrid = imageGrid.transposed(withPermutations: [0, 2, 1, 3])
imageGrid = imageGrid.reshaped(to: [(imageHeight+2)*testImageGridSize,
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
imageGrid = imageGrid.reshaped(to: [(imageHeight+2)*testImageGridSize,
imageGrid = imageGrid.reshaped(to: [(imageHeight + 2) * testImageGridSize,

GAN/main.swift Outdated
// Transpose to create single image.
imageGrid = imageGrid.transposed(withPermutations: [0, 2, 1, 3])
imageGrid = imageGrid.reshaped(to: [(imageHeight+2)*testImageGridSize,
(imageWidth+2)*testImageGridSize])
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
(imageWidth+2)*testImageGridSize])
(imageWidth + 2) * testImageGridSize])

GAN/main.swift Outdated
}

struct Discriminator: Layer {
var dense1 = Dense<Float>(inputSize: imageSize, outputSize: 256, activation: { leakyRelu($0) })
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
var dense1 = Dense<Float>(inputSize: imageSize, outputSize: 256, activation: { leakyRelu($0) })
var dense1 = Dense<Float>(inputSize: imageSize, outputSize: 256,
activation: { leakyRelu($0) })

For consistency with other dense layers below.

GAN/main.swift Outdated
let array = np.array([image.scalars])
let pixels = array.reshape(image.shape)
if !FileManager.default.fileExists(atPath: outputFolder) {
try! FileManager.default.createDirectory(atPath: outputFolder,
Copy link
Contributor

Choose a reason for hiding this comment

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

We aren't using Objective-C style formatting for function call arguments. Could you reformat this like the following?

Suggested change
try! FileManager.default.createDirectory(atPath: outputFolder,
try! FileManager.default.createDirectory(
atPath: outputFolder,
withIntermediateDirectories: false,
attributes: nil)

GAN/main.swift Outdated
let imageSize = imageHeight * imageWidth
let latentSize = 64

func plot(image: Tensor<Float>, name: String) {
Copy link
Contributor

Choose a reason for hiding this comment

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

When the first argument label happens to be the object of the overall verb phrase, append it to the base name and omit the argument label.

Suggested change
func plot(image: Tensor<Float>, name: String) {
func plotImage(_ image: Tensor<Float>, name: String) {

GAN/main.swift Outdated
// Turn off using display on server / Linux.
matplotlib.use("Agg")

// Some globals
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
// Some globals

This comment isn't providing much useful information as the code is self-explanatorily "some globals".

GAN/main.swift Outdated

/// Returns `size` samples of noise vector.
func sampleVector(size: Int) -> Tensor<Float> {
Tensor<Float>(randomNormal: [size, latentSize])
Copy link
Contributor

Choose a reason for hiding this comment

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

Omit redundant type information since it can be inferred from the return type.

Suggested change
Tensor<Float>(randomNormal: [size, latentSize])
Tensor(randomNormal: [size, latentSize])

GAN/main.swift Outdated
print("Reading data.")
let images = readFile(imagesFile).dropFirst(16).map { Float($0) }
let rowCount = images.count / imageSize

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove redundant empty line.

GAN/README.md Outdated

To train the model, run:

```
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
```
```sh

GAN/README.md Outdated
```
swift run GAN
```
If you using brew to install python2 and modules, change the path:
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Not sure what you mean exactly by "modules".
  • I feel lines 24-30 are unnecessary since they are just describing an installation step that's required for the entire models repository.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It came from Autoencoder/README.md.
I just copied it and didn't consider much.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah ok, we should unify the documentation in all models. @BradLarson how about having a standard README template?

Copy link
Contributor

Choose a reason for hiding this comment

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

@rxwei - We definitely will need to rework the READMEs across the examples. Varying levels of information is provided in each, as well as the language used for describing the models. A template for examples would be much appreciated, as well as a good central listing of them. The original Autoencoder README was a little rough (and I think the Python information was confusing and missing the need for matplotlib, etc.), thus the issues with this one derived from it.

GAN/README.md Outdated
@@ -0,0 +1,30 @@
# Simple GAN

### After Epoch 1
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
### After Epoch 1
After Epoch 1:

GAN/README.md Outdated
<img src="images/epoch-1-output.png" height="270" width="360">
</p>

### After Epoch 10
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
### After Epoch 10
After Epoch 10:

@BradLarson BradLarson merged commit d6f4496 into tensorflow:master Jul 26, 2019
@BradLarson
Copy link
Contributor

Thank you for the great example. Sorry about the more involved process, when we reorganize and clean up the repository it should be easier for everyone to contribute models and examples like this. You'll have to copy over a lot less code, for one thing, which means less to review.

We appreciate your patience in the meantime.

@t-ae t-ae deleted the gan-example branch July 26, 2019 14:34
ematejska added a commit that referenced this pull request Sep 24, 2019
* Use PascalCase for all Swift source files (#152)

Except `main.swift` files which are the entry points for executables.

Running the following command does not produce any output:

`find . -type f -name "[[:lower:]]*.swift" | rg --pcre2 "^(?!.*(main.swift))"`

Resolves #133.

* Load config variable from `hparams.json` file so that Transformer can work with the bigger GPT-2 models (It is called "staged release". as of now, only 117M and 345M are available). (#154)

* Style fixes from #154 (#155)

* A few quick fixes to help unbreak swift-models. (#160)

* Unbreak models by inserting `.call`. (#161)

See https://bugs.swift.org/browse/TF-516 for additional context.

* s/CotangentVector/TangentVector/g (#162)

* Add MNIST test set evaluation and change hyperparameters. (#163)

- Add MNIST test set evaluation.
- The batch size and the optimizer are changed to `128` and `Adam`, respectively, based on test set evaluation results. Tested with higher batch sizes [256, 512], but found no improvement in performance.

* Updated models to use revised name for callable (SE-0253), fixed a few issues caused by `swift-apis` changes. (#166)

* Updated Transformer and MNIST models to work with 2019-06-04 development snapshot.
* Updated other models.
* Updated ResNet to work with 2019-06-04 development snapshot.
* Updated Catch and CIFAR models.
* Added a method to satisfy TensorGroup protocol that can pass build.

* transformer: upstream api changes (#171)

* rebuild resnet block based approach (#170)

* add gym blackjack qlearning demo (#173)

* Make 'GoModel' stored properties be variables. (#174)

New 'Differentiable' derived conformances will not include constant properties in the tangent space.

* Added .swift-format and updated .gitignore for Xcode 11's SwiftPM support. (#176)

This replicates the following pull request on swift-apis: tensorflow/swift-apis#374 , adding a `swift-format` configuration file. Note the cautions indicated in that pull request around use of `swift-format` at present.

This also adds a .gitignore line to prevent Xcode 11's new SwiftPM support from adding supporting files to the repository.

* Replaced Python with Swift in CIFAR10 dataset loading (#178)

* Replaced all Python code in the CIFAR10 and ResNet examples, removing Python 3 dependency.

* Needed to import FoundationNetworking on Linux.

* Added a check for FoundationNetworking, added an early exit for cached directory check.

* Removed macOS availability check by targeting 10.13 in the package.

* Style and formatting fixes.

* Removed no-longer-needed _tensorHandles and supporting code.

* Replace Autoencoder's tanh activation with sigmoid (#180)

* Add GAN Example (#181)

* Add GAN Example

* Remove do blocks

* Replace lrelu with closure

* Remove typealiases

* Add comment

* Remove labels in GAN example

* Rename variables

* Code formatting, update comments

* Fix: latentDim -> latentSize

* Add spaces around *

* Code formatting, rename loss functions

* Fix: generatorLossFunc -> generatorLoss

* Break lines to make it fit within 100 columns

* Update comments

* Rename plot->plotImage, imageGrid->gridImage, Code formatting

* Refactor: Label creation

* Update comment

* Remove type parameter, empty line

* Update readme

* nightlies URL: s4tf-kokoro-artifact-testing => swift-tensorflow-artifacts (#183)

* First steps in repository reorganization: extracting common MNIST dataset code (#182)

* Extracted MNIST dataset, created LeNet network, added example combining the two.

* Extracted redundant MNIST loading code from GAN and Autoencoder examples, replaced with central MNIST dataset.

* Renamed input parameters and applied standard formatting style to MNIST.

* Punctuation correction.

Co-Authored-By: Richard Wei <[email protected]>

* README formatting update.

Co-Authored-By: Richard Wei <[email protected]>

* Renamed trainImages -> trainingImages, corrected Python package names, formatted Package.swift.

* Update Dockerfile to install Python libraries (#184)

* Delete helpers.swift (#187)

This file is no longer needed apple/swift #26023 and may be causing the segfault reported in swift-apis #186.

* Continuing repository reorganization: extracting common CIFAR-10 and ResNet code (#185)

* Extracted CIFAR-10 dataset and ResNet models into respective modules.

* Minor formatting fixes.

* Mirroring PR #187.

* [Models] Fix enumeration of blocks in `ResidualBasicBlockStack` `init` (#192)

* [Models] Fix enumeration of blocks in `ResidualBasicBlockStack` initialization

* Start range at

* Update ranges

* SqueezeNet Implementation (#189)

* Add files via upload

* Implemented requested changes

Corrected formatting mistakes, used dropout correctly, removed the hard coded number of classes and improved overall readability.

* Update SqeezeNet.swift

Renamed numClasses to classCount and limited all lines to a size of 100.

* WideResNet - fix widenFactor and match model to citation (#193)

* add identity connections to WideResNet

* rename preact1 for clarity

* remove extra relu, add dropout

* fix declarartion

* skip dropout in expansion blocks

* remove enum, res layers to one line

* Removal of deprecated allDifferentiableVariables. (#194)

* Add JPEG loading / saving via Raw TF operations, removing Matplotlib dependencies (#188)

* Added an Image struct as a wrapper for JPEG loading / saving, removed matplotlib dependency from GAN and Autoencoder examples using this.

* Formatting update for Autoencoder.

* Bring this inline with current API.

* Made saveImage() a throwing function, improved formatting.

* Changed function parameter.

* Convert MNIST classifier to use sequential (#200)

* Convert MNIST classifier to use sequential

* Review Changes

* Remove ImageClassification Models

* Convert Autoencoder and Catch to use Sequential (#203)

Partially fixes #202.

* Adding shape-based inference tests for all image classification models (#198)

* Implemented inference tests with random tensors and starting weights for all classification models.

* Made sure tests ran on Linux, reshaped output of SqueezeNet to match other classification models.

* WideResNet is expressed in terms of CIFAR10, so altered the inputs and outputs appropriately.

* Wrapping the reshaping line in SqueezeNet.

* Reset ownership.

* Reworked TensorShape initializers to use array literals.

* Minor formatting tweak to SqueezeNet.

* Update deprecated APIs in Catch (#205)

[swift-apis/#497](tensorflow/swift-apis#497) removes deprecated apis, now that we are moving onward to v0.5. This PR updates the catch file which uses a deprecated dense layer.

* Update squeezenet and add V1.1 version (#204)

* Update squeezenet and add V1.1 version

* value error

* Update tests

* review changes

* Fix '@noDerivative' warnings. (#208) (#209)

(cherry picked from commit db72e4d)
BradLarson added a commit that referenced this pull request Nov 22, 2019
* Use PascalCase for all Swift source files (#152)

Except `main.swift` files which are the entry points for executables.

Running the following command does not produce any output:

`find . -type f -name "[[:lower:]]*.swift" | rg --pcre2 "^(?!.*(main.swift))"`

Resolves #133.

* Load config variable from `hparams.json` file so that Transformer can work with the bigger GPT-2 models (It is called "staged release". as of now, only 117M and 345M are available). (#154)

* Style fixes from #154 (#155)

* A few quick fixes to help unbreak swift-models. (#160)

* Unbreak models by inserting `.call`. (#161)

See https://bugs.swift.org/browse/TF-516 for additional context.

* s/CotangentVector/TangentVector/g (#162)

* Add MNIST test set evaluation and change hyperparameters. (#163)

- Add MNIST test set evaluation.
- The batch size and the optimizer are changed to `128` and `Adam`, respectively, based on test set evaluation results. Tested with higher batch sizes [256, 512], but found no improvement in performance.

* Updated models to use revised name for callable (SE-0253), fixed a few issues caused by `swift-apis` changes. (#166)

* Updated Transformer and MNIST models to work with 2019-06-04 development snapshot.
* Updated other models.
* Updated ResNet to work with 2019-06-04 development snapshot.
* Updated Catch and CIFAR models.
* Added a method to satisfy TensorGroup protocol that can pass build.

* transformer: upstream api changes (#171)

* rebuild resnet block based approach (#170)

* add gym blackjack qlearning demo (#173)

* Make 'GoModel' stored properties be variables. (#174)

New 'Differentiable' derived conformances will not include constant properties in the tangent space.

* Added .swift-format and updated .gitignore for Xcode 11's SwiftPM support. (#176)

This replicates the following pull request on swift-apis: tensorflow/swift-apis#374 , adding a `swift-format` configuration file. Note the cautions indicated in that pull request around use of `swift-format` at present.

This also adds a .gitignore line to prevent Xcode 11's new SwiftPM support from adding supporting files to the repository.

* Replaced Python with Swift in CIFAR10 dataset loading (#178)

* Replaced all Python code in the CIFAR10 and ResNet examples, removing Python 3 dependency.

* Needed to import FoundationNetworking on Linux.

* Added a check for FoundationNetworking, added an early exit for cached directory check.

* Removed macOS availability check by targeting 10.13 in the package.

* Style and formatting fixes.

* Removed no-longer-needed _tensorHandles and supporting code.

* Replace Autoencoder's tanh activation with sigmoid (#180)

* Add GAN Example (#181)

* Add GAN Example

* Remove do blocks

* Replace lrelu with closure

* Remove typealiases

* Add comment

* Remove labels in GAN example

* Rename variables

* Code formatting, update comments

* Fix: latentDim -> latentSize

* Add spaces around *

* Code formatting, rename loss functions

* Fix: generatorLossFunc -> generatorLoss

* Break lines to make it fit within 100 columns

* Update comments

* Rename plot->plotImage, imageGrid->gridImage, Code formatting

* Refactor: Label creation

* Update comment

* Remove type parameter, empty line

* Update readme

* nightlies URL: s4tf-kokoro-artifact-testing => swift-tensorflow-artifacts (#183)

* First steps in repository reorganization: extracting common MNIST dataset code (#182)

* Extracted MNIST dataset, created LeNet network, added example combining the two.

* Extracted redundant MNIST loading code from GAN and Autoencoder examples, replaced with central MNIST dataset.

* Renamed input parameters and applied standard formatting style to MNIST.

* Punctuation correction.

Co-Authored-By: Richard Wei <[email protected]>

* README formatting update.

Co-Authored-By: Richard Wei <[email protected]>

* Renamed trainImages -> trainingImages, corrected Python package names, formatted Package.swift.

* Update Dockerfile to install Python libraries (#184)

* Delete helpers.swift (#187)

This file is no longer needed apple/swift #26023 and may be causing the segfault reported in swift-apis #186.

* Continuing repository reorganization: extracting common CIFAR-10 and ResNet code (#185)

* Extracted CIFAR-10 dataset and ResNet models into respective modules.

* Minor formatting fixes.

* Mirroring PR #187.

* [Models] Fix enumeration of blocks in `ResidualBasicBlockStack` `init` (#192)

* [Models] Fix enumeration of blocks in `ResidualBasicBlockStack` initialization

* Start range at

* Update ranges

* SqueezeNet Implementation (#189)

* Add files via upload

* Implemented requested changes

Corrected formatting mistakes, used dropout correctly, removed the hard coded number of classes and improved overall readability.

* Update SqeezeNet.swift

Renamed numClasses to classCount and limited all lines to a size of 100.

* WideResNet - fix widenFactor and match model to citation (#193)

* add identity connections to WideResNet

* rename preact1 for clarity

* remove extra relu, add dropout

* fix declarartion

* skip dropout in expansion blocks

* remove enum, res layers to one line

* Removal of deprecated allDifferentiableVariables. (#194)

* Add JPEG loading / saving via Raw TF operations, removing Matplotlib dependencies (#188)

* Added an Image struct as a wrapper for JPEG loading / saving, removed matplotlib dependency from GAN and Autoencoder examples using this.

* Formatting update for Autoencoder.

* Bring this inline with current API.

* Made saveImage() a throwing function, improved formatting.

* Changed function parameter.

* Convert MNIST classifier to use sequential (#200)

* Convert MNIST classifier to use sequential

* Review Changes

* Remove ImageClassification Models

* Convert Autoencoder and Catch to use Sequential (#203)

Partially fixes #202.

* Adding shape-based inference tests for all image classification models (#198)

* Implemented inference tests with random tensors and starting weights for all classification models.

* Made sure tests ran on Linux, reshaped output of SqueezeNet to match other classification models.

* WideResNet is expressed in terms of CIFAR10, so altered the inputs and outputs appropriately.

* Wrapping the reshaping line in SqueezeNet.

* Reset ownership.

* Reworked TensorShape initializers to use array literals.

* Minor formatting tweak to SqueezeNet.

* Update deprecated APIs in Catch (#205)

[swift-apis/#497](tensorflow/swift-apis#497) removes deprecated apis, now that we are moving onward to v0.5. This PR updates the catch file which uses a deprecated dense layer.

* Update squeezenet and add V1.1 version (#204)

* Update squeezenet and add V1.1 version

* value error

* Update tests

* review changes

* Fix '@noDerivative' warnings. (#208)

* Indentation and formatting fixes in CartPole (#214)

* DenseNet Implementaion (#213)

* Create DenseNet.swift

Implementation for the DenseNet Architecture

* Added test for DenseNet

* Fixed Typo

* Refractored the code

* Updated ConvPair description

Co-Authored-By: Richard Wei <[email protected]>

* Fixed comment

Co-Authored-By: Richard Wei <[email protected]>

* Fixed typos, and improved code quality

* Removed extra whitespace and '\'

* Used 3 '/' for documentation and removed return

* Renamed DenseNet to DenseNet121

* Renamed tests

* Updated names

* Renamed all DenseNet identifiers to DenseNet121

* Download MNIST dataset from remote URL (#215)

This PR is intended to fix the second item listed in [this issue](#206):

> it currently relies on hardcoded paths, which will break if you take the dataset outside of that project and try to use it in something like Colab.

In this PR, the datasets are instead downloaded from a remote URL, so they are not fragile with respect to the current working directory where the MNIST dataset is instantiated from.

The implementation in this PR brings the MINST dataset in line with how the CFAR10 dataset is loaded.

* use enable in _vjpCausallyMasked (#218)

Fixes #217

* Change momentum and epsilon properties to scalars. (#220)

* Uses switch instead of ifs (#219)

* Fixes deprecation warning in MiniGo (#221)

* Fixing deprecation warnings on all but the MiniGo example. (#223)

* Initial training and inference benchmarks (#222)

* Initial implementation of training and inference benchmarks.

* Resolved a typechecker issue.

* Added a Readme.

* Added copyright headers.

* Reworked the benchmarking functions to use a single function that is specialized via enums.

* Reworked the model-specific benchmark into general inference and training cases that can work on arbitrary image classification models.

* Restructured BenchmarkResults to be a plain collection of timings, with specific benchmark processing working on that.

* Rename interpretTimings to interpretedTimings.

Co-Authored-By: Dan Zheng <[email protected]>

* Change reference to interpretedTimings later.
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.

3 participants