-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathProgram.cs
More file actions
88 lines (75 loc) · 2.97 KB
/
Copy pathProgram.cs
File metadata and controls
88 lines (75 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
using System.IO;
using System.Reflection;
using TorchSharp.Examples.Utils;
namespace CSharpExamples
{
public class Program
{
static void Main(string[] args)
{
var argumentsPath = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "arguments.json");
var argumentParser = new ArgumentParser(new FileInfo(argumentsPath), args);
if (argumentParser.Count == 0)
{
argumentParser.UsingMessage("CSharpExamples", "<model-name>");
return;
}
argumentParser.TryGetValue("epochs", out int epochs, 16);
argumentParser.TryGetValue("timeout", out int timeout, 3600);
argumentParser.TryGetValue("logdir", out string logdir, null);
for (var idx = 0; idx < argumentParser.Count; idx++)
{
switch(argumentParser[idx].ToLower())
{
case "mnist":
case "fashion-mnist":
MNIST.Run(epochs, timeout, logdir, argumentParser[idx].ToLower());
break;
case "fgsm":
case "fashion-fgsm":
AdversarialExampleGeneration.Run(epochs, timeout, logdir, argumentParser[idx].ToLower());
break;
case "alexnet":
case "resnet":
case "mobilenet":
case "resnet18":
case "resnet34":
case "resnet50":
#if false
// The following are disabled, because they require big CUDA processors in order to run.
case "resnet101":
case "resnet152":
#endif
case "vgg11":
case "vgg13":
case "vgg16":
case "vgg19":
CIFAR10.Run(epochs, timeout, logdir, argumentParser[idx]);
break;
case "text":
TextClassification.Run(epochs, timeout, logdir);
break;
case "seq2seq":
SequenceToSequence.Run(epochs, timeout, logdir);
break;
case "vae":
VAE.Run(epochs, timeout, logdir);
break;
case "dcgan":
DCGAN.Run(epochs, timeout, logdir);
break;
case "regression":
Regression.Run(epochs, timeout);
break;
case "mnist-rnn":
MNISTRnn.Run(epochs, timeout, logdir);
break;
default:
Console.Error.WriteLine($"Unknown model name: {argumentParser[idx]}");
break;
}
}
}
}
}