gorgonia.org/gorgonia@v0.9.17/bench_concurrent_training_test.go (about) 1 package gorgonia_test 2 3 import ( 4 "io" 5 "runtime" 6 "testing" 7 8 "gorgonia.org/tensor" 9 ) 10 11 func BenchmarkTrainingConcurrent(b *testing.B) { 12 xV, yV, bs := prep() 13 14 for i := 0; i < b.N; i++ { 15 concurrentTraining(xV, yV, bs, 10) 16 } 17 18 runtime.GC() 19 } 20 21 func BenchmarkTrainingNonConcurrent(b *testing.B) { 22 xV, yV, _ := prep() 23 24 for i := 0; i < b.N; i++ { 25 nonConcurrentTraining(xV, yV, 10) 26 } 27 28 runtime.GC() 29 } 30 31 func BenchmarkTapeMachineExecution(b *testing.B) { 32 m, c, machine := linregSetup(tensor.Float64) 33 for i := 0; i < b.N; i++ { 34 linregRun(m, c, machine, 100, false) 35 } 36 machine.(io.Closer).Close() 37 }