More parameter test updates

master
agibsonccc 2021-03-18 16:45:39 +09:00
parent d1989b8529
commit 06fab1d8ee
4 changed files with 20 additions and 22 deletions

View File

@ -20,6 +20,7 @@
package org.deeplearning4j.datasets.datavec; package org.deeplearning4j.datasets.datavec;
import org.junit.jupiter.api.Disabled;
import org.nd4j.shade.guava.io.Files; import org.nd4j.shade.guava.io.Files;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
@ -68,6 +69,7 @@ import java.nio.file.Path;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@DisplayName("Record Reader Multi Data Set Iterator Test") @DisplayName("Record Reader Multi Data Set Iterator Test")
@Disabled
class RecordReaderMultiDataSetIteratorTest extends BaseDL4JTest { class RecordReaderMultiDataSetIteratorTest extends BaseDL4JTest {
@TempDir @TempDir

View File

@ -256,7 +256,6 @@ class CNNGradientCheckTest extends BaseDL4JTest {
} }
} }
@Test
@DisplayName("Test Cnn With Space To Batch") @DisplayName("Test Cnn With Space To Batch")
@ParameterizedTest @ParameterizedTest
@MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params") @MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params")
@ -302,7 +301,6 @@ class CNNGradientCheckTest extends BaseDL4JTest {
} }
} }
@Test
@DisplayName("Test Cnn With Upsampling") @DisplayName("Test Cnn With Upsampling")
@ParameterizedTest @ParameterizedTest
@MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params") @MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params")
@ -338,7 +336,6 @@ class CNNGradientCheckTest extends BaseDL4JTest {
} }
} }
@Test
@DisplayName("Test Cnn With Subsampling") @DisplayName("Test Cnn With Subsampling")
@ParameterizedTest @ParameterizedTest
@MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params") @MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params")
@ -382,7 +379,6 @@ class CNNGradientCheckTest extends BaseDL4JTest {
} }
} }
@Test
@DisplayName("Test Cnn With Subsampling V 2") @DisplayName("Test Cnn With Subsampling V 2")
@ParameterizedTest @ParameterizedTest
@MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params") @MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params")
@ -422,7 +418,6 @@ class CNNGradientCheckTest extends BaseDL4JTest {
} }
} }
@Test
@DisplayName("Test Cnn Locally Connected 2 D") @DisplayName("Test Cnn Locally Connected 2 D")
@ParameterizedTest @ParameterizedTest
@MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params") @MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params")
@ -454,7 +449,6 @@ class CNNGradientCheckTest extends BaseDL4JTest {
} }
} }
@Test
@DisplayName("Test Cnn Multi Layer") @DisplayName("Test Cnn Multi Layer")
@ParameterizedTest @ParameterizedTest
@MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params") @MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params")
@ -496,7 +490,6 @@ class CNNGradientCheckTest extends BaseDL4JTest {
} }
} }
@Test
@DisplayName("Test Cnn Same Padding Mode") @DisplayName("Test Cnn Same Padding Mode")
@ParameterizedTest @ParameterizedTest
@MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params") @MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params")
@ -532,7 +525,6 @@ class CNNGradientCheckTest extends BaseDL4JTest {
} }
} }
@Test
@DisplayName("Test Cnn Same Padding Mode Strided") @DisplayName("Test Cnn Same Padding Mode Strided")
@ParameterizedTest @ParameterizedTest
@MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params") @MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params")
@ -577,7 +569,6 @@ class CNNGradientCheckTest extends BaseDL4JTest {
} }
} }
@Test
@DisplayName("Test Cnn Zero Padding Layer") @DisplayName("Test Cnn Zero Padding Layer")
@ParameterizedTest @ParameterizedTest
@MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params") @MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params")
@ -625,7 +616,6 @@ class CNNGradientCheckTest extends BaseDL4JTest {
} }
} }
@Test
@DisplayName("Test Deconvolution 2 D") @DisplayName("Test Deconvolution 2 D")
@ParameterizedTest @ParameterizedTest
@MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params") @MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params")
@ -672,7 +662,6 @@ class CNNGradientCheckTest extends BaseDL4JTest {
} }
} }
@Test
@DisplayName("Test Separable Conv 2 D") @DisplayName("Test Separable Conv 2 D")
@ParameterizedTest @ParameterizedTest
@MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params") @MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params")
@ -719,7 +708,6 @@ class CNNGradientCheckTest extends BaseDL4JTest {
} }
} }
@Test
@DisplayName("Test Cnn Dilated") @DisplayName("Test Cnn Dilated")
@ParameterizedTest @ParameterizedTest
@MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params") @MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params")
@ -771,7 +759,6 @@ class CNNGradientCheckTest extends BaseDL4JTest {
} }
} }
@Test
@DisplayName("Test Cropping 2 D Layer") @DisplayName("Test Cropping 2 D Layer")
@ParameterizedTest @ParameterizedTest
@MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params") @MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params")
@ -817,7 +804,6 @@ class CNNGradientCheckTest extends BaseDL4JTest {
} }
} }
@Test
@DisplayName("Test Depthwise Conv 2 D") @DisplayName("Test Depthwise Conv 2 D")
@ParameterizedTest @ParameterizedTest
@MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params") @MethodSource("org.deeplearning4j.gradientcheck.CNNGradientCheckTest#params")

View File

@ -92,7 +92,7 @@ public class YoloGradientCheckTests extends BaseDL4JTest {
} }
@ParameterizedTest @ParameterizedTest
@MethodSource("org.deeplearning4j.gradientcheckYoloGradientCheckTests.#params") @MethodSource("org.deeplearning4j.gradientcheck.YoloGradientCheckTests#params")
public void testYoloOutputLayer(CNN2DFormat format,Nd4jBackend backend) { public void testYoloOutputLayer(CNN2DFormat format,Nd4jBackend backend) {
int depthIn = 2; int depthIn = 2;
int c = 3; int c = 3;
@ -192,7 +192,7 @@ public class YoloGradientCheckTests extends BaseDL4JTest {
@ParameterizedTest @ParameterizedTest
@MethodSource("org.deeplearning4j.gradientcheckYoloGradientCheckTests#params") @MethodSource("org.deeplearning4j.gradientcheck.YoloGradientCheckTests#params")
public void yoloGradientCheckRealData(CNN2DFormat format,Nd4jBackend backend) throws Exception { public void yoloGradientCheckRealData(CNN2DFormat format,Nd4jBackend backend) throws Exception {
Nd4j.getRandom().setSeed(12345); Nd4j.getRandom().setSeed(12345);
InputStream is1 = new ClassPathResource("yolo/VOC_TwoImage/JPEGImages/2007_009346.jpg").getInputStream(); InputStream is1 = new ClassPathResource("yolo/VOC_TwoImage/JPEGImages/2007_009346.jpg").getInputStream();

View File

@ -39,13 +39,17 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.MethodSource;
import org.nd4j.enums.RnnDataFormat; import org.nd4j.enums.RnnDataFormat;
import org.nd4j.linalg.BaseNd4jTestWithBackends;
import org.nd4j.linalg.api.ndarray.INDArray; import org.nd4j.linalg.api.ndarray.INDArray;
import org.nd4j.linalg.factory.Nd4j; import org.nd4j.linalg.factory.Nd4j;
import org.nd4j.linalg.factory.Nd4jBackend;
import org.nd4j.linalg.indexing.NDArrayIndex; import org.nd4j.linalg.indexing.NDArrayIndex;
import org.deeplearning4j.nn.workspace.LayerWorkspaceMgr; import org.deeplearning4j.nn.workspace.LayerWorkspaceMgr;
import org.nd4j.linalg.learning.config.AdaGrad; import org.nd4j.linalg.learning.config.AdaGrad;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream; import java.util.stream.Stream;
import static org.deeplearning4j.nn.api.OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT; import static org.deeplearning4j.nn.api.OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT;
@ -58,13 +62,19 @@ import static org.nd4j.linalg.lossfunctions.LossFunctions.LossFunction.MSE;
public class TestLastTimeStepLayer extends BaseDL4JTest { public class TestLastTimeStepLayer extends BaseDL4JTest {
public static Stream<Arguments> params(){ public static Stream<Arguments> params() {
return Arrays.asList(RNNFormat.values()).stream().map(Arguments::of); List<Arguments> args = new ArrayList<>();
for(Nd4jBackend nd4jBackend : BaseNd4jTestWithBackends.BACKENDS) {
for(RNNFormat rnnFormat : RNNFormat.values()) {
args.add(Arguments.of(rnnFormat,nd4jBackend));
}
}
return args.stream();
} }
@ParameterizedTest @ParameterizedTest
@MethodSource("#params") @MethodSource("org.deeplearning4j.nn.layers.recurrent.TestLastTimeStepLayer#params")
public void testLastTimeStepVertex(RNNFormat rnnDataFormat) { public void testLastTimeStepVertex(RNNFormat rnnDataFormat,Nd4jBackend backend) {
ComputationGraphConfiguration conf = new NeuralNetConfiguration.Builder().graphBuilder().addInputs("in") ComputationGraphConfiguration conf = new NeuralNetConfiguration.Builder().graphBuilder().addInputs("in")
.addLayer("lastTS", new LastTimeStep(new SimpleRnn.Builder() .addLayer("lastTS", new LastTimeStep(new SimpleRnn.Builder()
@ -127,8 +137,8 @@ public class TestLastTimeStepLayer extends BaseDL4JTest {
} }
@ParameterizedTest @ParameterizedTest
@MethodSource("#params") @MethodSource("org.deeplearning4j.nn.layers.recurrent.TestLastTimeStepLayer#params")
public void testMaskingAndAllMasked(RNNFormat rnnDataFormat) { public void testMaskingAndAllMasked(RNNFormat rnnDataFormat,Nd4jBackend backend) {
ComputationGraphConfiguration.GraphBuilder builder = new NeuralNetConfiguration.Builder() ComputationGraphConfiguration.GraphBuilder builder = new NeuralNetConfiguration.Builder()
.optimizationAlgo(STOCHASTIC_GRADIENT_DESCENT) .optimizationAlgo(STOCHASTIC_GRADIENT_DESCENT)
.weightInit(XAVIER_UNIFORM) .weightInit(XAVIER_UNIFORM)