use of com.simiacryptus.mindseye.test.unit.ComponentTestBase in project MindsEye by SimiaCryptus.
the class ImgCropLayerTest method getPerformanceTester.
@Nullable
@Override
public ComponentTest<ToleranceStatistics> getPerformanceTester() {
@Nonnull ComponentTest<ToleranceStatistics> inner = new PerformanceTester().setSamples(100).setBatches(10);
return new ComponentTestBase<ToleranceStatistics>() {
@Override
public ToleranceStatistics test(@Nonnull NotebookOutput log, Layer component, Tensor... inputPrototype) {
@Nullable PrintStream apiLog = null;
try {
apiLog = new PrintStream(log.file("cuda_perf.log"));
CudaSystem.addLog(apiLog);
return inner.test(log, component, inputPrototype);
} finally {
log.p(log.file((String) null, "cuda_perf.log", "GPU Log"));
if (null != apiLog) {
apiLog.close();
CudaSystem.apiLog.remove(apiLog);
}
}
}
@Override
protected void _free() {
inner.freeRef();
super._free();
}
};
}
use of com.simiacryptus.mindseye.test.unit.ComponentTestBase in project MindsEye by SimiaCryptus.
the class CudaLayerTestBase method getReferenceIOTester.
@Nullable
@Override
protected ComponentTest<ToleranceStatistics> getReferenceIOTester() {
@Nullable final ComponentTest<ToleranceStatistics> inner = super.getReferenceIOTester();
return new ComponentTestBase<ToleranceStatistics>() {
@Override
protected void _free() {
inner.freeRef();
super._free();
}
@Override
public ToleranceStatistics test(@Nonnull NotebookOutput log, Layer component, Tensor... inputPrototype) {
@Nullable PrintStream apiLog = null;
try {
@Nonnull String logName = "cuda_" + log.getName() + "_io.log";
log.p(log.file((String) null, logName, "GPU Log"));
apiLog = new PrintStream(log.file(logName));
CudaSystem.addLog(apiLog);
return inner.test(log, component, inputPrototype);
} finally {
if (null != apiLog) {
apiLog.close();
CudaSystem.apiLog.remove(apiLog);
}
}
}
};
}
use of com.simiacryptus.mindseye.test.unit.ComponentTestBase in project MindsEye by SimiaCryptus.
the class CudaLayerTestBase method getPerformanceTester.
@Nullable
@Override
public ComponentTest<ToleranceStatistics> getPerformanceTester() {
@Nullable ComponentTest<ToleranceStatistics> inner = new PerformanceTester().setBatches(testingBatchSize);
return new ComponentTestBase<ToleranceStatistics>() {
@Override
protected void _free() {
inner.freeRef();
super._free();
}
@Override
public ToleranceStatistics test(@Nonnull NotebookOutput log, Layer component, Tensor... inputPrototype) {
@Nullable PrintStream apiLog = null;
try {
@Nonnull String logName = "cuda_" + log.getName() + "_perf.log";
log.p(log.file((String) null, logName, "GPU Log"));
apiLog = new PrintStream(log.file(logName));
CudaSystem.addLog(apiLog);
return inner.test(log, component, inputPrototype);
} finally {
if (null != apiLog) {
apiLog.close();
CudaSystem.apiLog.remove(apiLog);
}
}
}
};
}
Aggregations