Java Code Examples for org.deeplearning4j.nn.workspace.LayerWorkspaceMgr#validateArrayLocation()

The following examples show how to use org.deeplearning4j.nn.workspace.LayerWorkspaceMgr#validateArrayLocation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultiLayerNetwork.java    From deeplearning4j with Apache License 2.0 6 votes vote down vote up
protected void validateArrayWorkspaces(LayerWorkspaceMgr mgr, INDArray array, ArrayType arrayType, int layerIdx,
                                       boolean isPreprocessor, String op){
    try{
        mgr.validateArrayLocation(arrayType, array, false, layerIdx > 0);
    } catch (ND4JWorkspaceException e){
        String layerName = layers[layerIdx].conf().getLayer().getLayerName();
        String clazz;
        if(isPreprocessor){
            clazz = layerWiseConfigurations.getInputPreProcess(layerIdx).getClass().getName();
        } else {
            clazz = layers[layerIdx].getClass().getName();
        }
        throw new IllegalStateException(op + ": array (" + arrayType + ") workspace validation failed (" +
                (isPreprocessor ? "preprocessor" : "layer ") + layerIdx + (layerName != null ? " - layer name \"" +
                layerName + "\"" : "") + " - class: " + clazz + ") - array is defined in incorrect workspace", e);
    }
}
 
Example 2
Source File: Cropping3DLayer.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Override
public INDArray activate(boolean training, LayerWorkspaceMgr workspaceMgr) {
    assertInputSet(false);
    INDArray ret = inputSubset(input);
    ret = workspaceMgr.leverageTo(ArrayType.ACTIVATIONS, ret);
    workspaceMgr.validateArrayLocation(ArrayType.ACTIVATIONS, ret, false, false);
    return ret;
}
 
Example 3
Source File: Cropping2DLayer.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Override
public INDArray activate(boolean training, LayerWorkspaceMgr workspaceMgr) {
    assertInputSet(false);
    INDArray ret = inputSubset(input);
    ret = workspaceMgr.leverageTo(ArrayType.ACTIVATIONS, ret);
    workspaceMgr.validateArrayLocation(ArrayType.ACTIVATIONS, ret, false, false);
    return ret;
}