Skip to content

Nullpointerexception in ComputationGraph.outputOfLayersDetached #10034

@cyberbeat

Description

@cyberbeat

I have a network with:

EmbeddingSequenceLayer
LastTimeStepVertex
LossLayer

and defined both, LastTimeStepVertex and LossLayer as output (for debugging purposes).

Training works, but inference throws an exception:

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.deeplearning4j.nn.workspace.LayerWorkspaceMgr.setHelperWorkspacePointers(java.util.Map)" because "workspaceMgr" is null
	at org.deeplearning4j.nn.graph.ComputationGraph.outputOfLayersDetached(ComputationGraph.java:2335)
	at org.deeplearning4j.nn.graph.ComputationGraph.output(ComputationGraph.java:1882)
...

In ComputationGraph.outputOfLayersDetached this code in line 2322 seems risky:

                if (closeAtEndIteraton[i] != null) {
                    for (MemoryWorkspace wsAct : closeAtEndIteraton[i]) {
                        wsAct.close();
                        LayerWorkspaceMgr canNowReuse = openActivationsWorkspaces.remove(wsAct);
                        freeWorkspaceManagers.add(canNowReuse);
                    }
                }

canNowReuse may be null - and is in my case, I tested with a if ..!=null statement before freeWorkspaceManagers.add(canNowReuse);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions