本文整理了Java中org.deeplearning4j.nn.conf.layers.ZeroPaddingLayer
类的一些代码示例,展示了ZeroPaddingLayer
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZeroPaddingLayer
类的具体详情如下:
包路径:org.deeplearning4j.nn.conf.layers.ZeroPaddingLayer
类名称:ZeroPaddingLayer
[英]Zero padding layer for convolutional neural networks. Allows padding to be done separately for top/bottom/left/right
[中]卷积神经网络的零填充层。允许上/下/左/右单独填充
代码示例来源:origin: Waikato/wekaDeeplearning4j
@Override
public void initializeBackend() {
this.backend = new org.deeplearning4j.nn.conf.layers.ZeroPaddingLayer();
}
}
代码示例来源:origin: org.deeplearning4j/deeplearning4j-nn
@Override
public InputPreProcessor getPreProcessorForInputType(InputType inputType) {
if (inputType == null) {
throw new IllegalStateException("Invalid input for ZeroPaddingLayer layer (layer name=\"" + getLayerName()
+ "\"): input is null");
}
return InputTypeUtil.getPreProcessorForInputTypeCnnLayers(inputType, getLayerName());
}
代码示例来源:origin: Waikato/wekaDeeplearning4j
public void setPadding(int[] padding) {
backend.setPadding(padding);
}
代码示例来源:origin: Waikato/wekaDeeplearning4j
@OptionMetadata(
displayName = "number of columns in padding",
description = "The number of columns in the padding (default = 0).",
commandLineParamName = "paddingColumns",
commandLineParamSynopsis = "-paddingColumns <int>",
displayOrder = 9
)
public int getPaddingColumns() {
return backend.getPadding()[1];
}
代码示例来源:origin: org.deeplearning4j/deeplearning4j-modelimport
/**
* Get layer output type.
*
* @param inputType Array of InputTypes
* @return output type as InputType
* @throws InvalidKerasConfigurationException
*/
@Override
public InputType getOutputType(InputType... inputType) throws InvalidKerasConfigurationException {
if (inputType.length > 1)
throw new InvalidKerasConfigurationException(
"Keras ZeroPadding layer accepts only one input (received " + inputType.length + ")");
return this.getZeroPaddingLayer().getOutputType(-1, inputType[0]);
}
代码示例来源:origin: org.deeplearning4j/deeplearning4j-nn
@Override
public org.deeplearning4j.nn.api.Layer instantiate(NeuralNetConfiguration conf,
Collection<IterationListener> iterationListeners, int layerIndex, INDArray layerParamsView,
boolean initializeParams) {
org.deeplearning4j.nn.layers.convolution.ZeroPaddingLayer ret =
new org.deeplearning4j.nn.layers.convolution.ZeroPaddingLayer(conf);
ret.setListeners(iterationListeners);
ret.setIndex(layerIndex);
Map<String, INDArray> paramTable = initializer().init(conf, layerParamsView, initializeParams);
ret.setParamTable(paramTable);
ret.setConf(conf);
return ret;
}
代码示例来源:origin: Waikato/wekaDeeplearning4j
@OptionMetadata(
displayName = "number of rows in padding",
description = "The number of rows in the padding (default = 0).",
commandLineParamName = "paddingRows",
commandLineParamSynopsis = "-paddingRows <int>",
displayOrder = 8
)
public int getPaddingRows() {
return backend.getPadding()[0];
}
代码示例来源:origin: org.deeplearning4j/deeplearning4j-nn
@Override
public LayerMemoryReport getMemoryReport(InputType inputType) {
InputType outputType = getOutputType(-1, inputType);
return new LayerMemoryReport.Builder(layerName, ZeroPaddingLayer.class, inputType, outputType)
.standardMemory(0, 0) //No params
//Inference and training is same - just output activations, no working memory in addition to that
.workingMemory(0, 0, MemoryReport.CACHE_MODE_ALL_ZEROS, MemoryReport.CACHE_MODE_ALL_ZEROS)
.cacheMemory(MemoryReport.CACHE_MODE_ALL_ZEROS, MemoryReport.CACHE_MODE_ALL_ZEROS) //No caching
.build();
}
代码示例来源:origin: Waikato/wekaDeeplearning4j
@ProgrammaticProperty
public int[] getPadding() {
return backend.getPadding();
}
代码示例来源:origin: org.deeplearning4j/deeplearning4j-nn
@Override
@SuppressWarnings("unchecked")
public ZeroPaddingLayer build() {
for (int p : padding) {
if (p < 0) {
throw new IllegalStateException(
"Invalid zero padding layer config: padding [top, bottom, left, right]"
+ " must be > 0 for all elements. Got: "
+ Arrays.toString(padding));
}
}
return new ZeroPaddingLayer(this);
}
}
代码示例来源:origin: Waikato/wekaDeeplearning4j
public void setPaddingColumns(int padding) {
int[] pad = new int[]{getPaddingRows(), padding};
backend.setPadding(pad);
}
代码示例来源:origin: org.deeplearning4j/deeplearning4j-nn
public ZeroPaddingLayer(NeuralNetConfiguration conf) {
super(conf);
this.padding = ((org.deeplearning4j.nn.conf.layers.ZeroPaddingLayer) conf.getLayer()).getPadding();
}
代码示例来源:origin: Waikato/wekaDeeplearning4j
public void setPaddingRows(int padding) {
int[] pad = new int[]{padding, getPaddingColumns()};
backend.setPadding(pad);
}
内容来源于网络,如有侵权,请联系作者删除!