Merge pull request #9204 from eclipse/ag_cropping_fixes

Keras cropping fixes
master
Adam Gibson 2021-03-05 14:17:52 +09:00 committed by GitHub
commit fa8537f0c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 13 deletions

View File

@ -370,10 +370,11 @@ public class KerasConvolutionUtils {
} else if ((paddingNoCast.size() == dimension) && isNested) {
for (int j = 0; j < dimension; j++) {
@SuppressWarnings("unchecked")
List<Integer> item = (List<Integer>) paddingNoCast.get(0);
List<Integer> item = (List<Integer>) paddingNoCast.get(j);
paddingList.add((item.get(0)));
paddingList.add((item.get(1)));
}
padding = ArrayUtil.toArray(paddingList);
} else {
throw new InvalidKerasConfigurationException("Found Keras ZeroPadding" + dimension

View File

@ -29,6 +29,8 @@ import org.deeplearning4j.nn.conf.layers.convolutional.Cropping2D;
import org.deeplearning4j.nn.modelimport.keras.KerasLayer;
import org.deeplearning4j.nn.modelimport.keras.exceptions.InvalidKerasConfigurationException;
import org.deeplearning4j.nn.modelimport.keras.exceptions.UnsupportedKerasConfigurationException;
import org.nd4j.common.util.ArrayUtil;
import org.nd4j.linalg.api.ndarray.INDArray;
import java.util.Map;