use of com.simiacryptus.mindseye.lang.LifecycleException in project MindsEye by SimiaCryptus.
the class StandardLayerTests method tests.
private void tests(final NotebookOutput log, final List<ComponentTest<?>> tests, @Nonnull final Invocation invocation, @Nonnull final ArrayList<TestError> exceptions) {
tests.stream().filter(x -> null != x).forEach((ComponentTest<?> test) -> {
@Nonnull Layer layer = invocation.getLayer().copy();
Tensor[] inputs = randomize(invocation.getDims());
try {
test.test(log, layer, inputs);
} catch (LifecycleException e) {
throw e;
} catch (Throwable e) {
exceptions.add(new TestError(e, test, layer));
} finally {
for (@Nonnull Tensor tensor : inputs) tensor.freeRef();
layer.freeRef();
test.freeRef();
System.gc();
}
});
}
use of com.simiacryptus.mindseye.lang.LifecycleException in project MindsEye by SimiaCryptus.
the class StandardLayerTests method bigTests.
/**
* Big tests.
*
* @param log the log
* @param seed the seed
* @param perfLayer the perf layer
* @param exceptions the exceptions
*/
public void bigTests(NotebookOutput log, long seed, @Nonnull Layer perfLayer, @Nonnull ArrayList<TestError> exceptions) {
getBigTests().stream().filter(x -> null != x).forEach(test -> {
@Nonnull Layer layer = perfLayer.copy();
try {
Tensor[] input = randomize(getLargeDims(new Random(seed)));
try {
test.test(log, layer, input);
} finally {
for (@Nonnull Tensor t : input) {
t.freeRef();
}
}
} catch (LifecycleException e) {
throw e;
} catch (CudaError e) {
throw e;
} catch (Throwable e) {
exceptions.add(new TestError(e, test, layer));
} finally {
layer.freeRef();
test.freeRef();
System.gc();
}
});
}
Aggregations