fixed initializing CUDA device at example/mnist cnn model

This commit is contained in:
sugarme 2021-07-23 16:26:39 +10:00
parent 7e9eb5bff2
commit 8baf32d860

View File

@ -74,9 +74,8 @@ func runCNN1() {
testImages := ds.TestImages
testLabels := ds.TestLabels
cuda := gotch.CudaBuilder(0)
vs := nn.NewVarStore(cuda.CudaIfAvailable())
// vs := nn.NewVarStore(gotch.CPU)
device := gotch.CudaIfAvailable()
vs := nn.NewVarStore(device)
net := newNet(vs.Root())
opt, err := nn.DefaultAdamConfig().Build(vs, LrCNN)