8000 Reduce the time of keras unittest. by AsakusaRinne · Pull Request #999 · SciSharp/TensorFlow.NET · GitHub
[go: up one dir, main page]

Skip to content

Reduce the time of keras unittest. #999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
8000
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void SimpleModelFromAutoCompile()
{
TrainDir = "mnist",
OneHot = false,
ValidationSize = 50000,
ValidationSize = 58000,
}).Result;

model.fit(dataset.Train.Data, dataset.Train.Labels, batch_size, num_epochs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ public class SequentialModelSave
[TestMethod]
public void SimpleModelFromAutoCompile()
{
var inputs = tf.keras.layers.Input((28, 28, 1));
var x = tf.keras.layers.Flatten().Apply(inputs);
x = tf.keras.layers.Dense(100, activation: tf.nn.relu).Apply(x);
x = tf.keras.layers.Dense(units: 10).Apply(x);
var outputs = tf.keras.layers.Softmax(axis: 1).Apply(x);
var model = tf.keras.Model(inputs, outputs);
var inputs = keras.layers.Input((28, 28, 1));
var x = keras.layers.Flatten().Apply(inputs);
x = keras.layers.Dense(100, activation: tf.nn.relu).Apply(x);
x = keras.layers.Dense(units: 10).Apply(x);
var outputs = keras.layers.Softmax(axis: 1).Apply(x);
var model = keras.Model(inputs, outputs);

model.compile(new Adam(0.001f),
tf.keras.losses.SparseCategoricalCrossentropy(),
keras.losses.SparseCategoricalCrossentropy(),
new string[] { "accuracy" });

var data_loader = new MnistModelLoader();
Expand All @@ -37,7 +37,7 @@ public void SimpleModelFromAutoCompile()
{
TrainDir = "mnist",
OneHot = false,
ValidationSize = 10000,
ValidationSize = 58000,
}).Result;

model.fit(dataset.Train.Data, dataset.Train.Labels, batch_size, num_epochs);
Expand Down Expand Up @@ -69,7 +69,7 @@ public void SimpleModelFromSequential()
{
TrainDir = "mnist",
OneHot = false,
ValidationSize = 50000,
ValidationSize = 58000,
}).Result;

model.fit(dataset.Train.Data, dataset.Train.Labels, batch_size, num_epochs);
Expand Down
0