Package org.nd4j.linalg.workspace
Class WorkspaceUtils
- java.lang.Object
-
- org.nd4j.linalg.workspace.WorkspaceUtils
-
public class WorkspaceUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
assertNoWorkspacesOpen(String msg)
Assert that no workspaces are currently openstatic void
assertNoWorkspacesOpen(String msg, boolean allowScopedOut)
Assert that no workspaces are currently openstatic void
assertOpenActiveAndCurrent(@NonNull String ws, @NonNull String errorMsg)
Assert that the specified workspace is open, active, and is the current workspacestatic void
assertOpenAndActive(@NonNull String ws, @NonNull String errorMsg)
Assert that the specified workspace is open and activestatic void
assertValidArray(INDArray array, String msg)
Assert that the specified array is valid, in terms of workspaces: i.e., if it is attached (and not in a circular workspace), assert that the workspace is open, and that the data is not from an old generation.
-
-
-
Method Detail
-
assertNoWorkspacesOpen
public static void assertNoWorkspacesOpen(String msg) throws ND4JWorkspaceException
Assert that no workspaces are currently open- Parameters:
msg
- Message to include in the exception, if required- Throws:
ND4JWorkspaceException
-
assertNoWorkspacesOpen
public static void assertNoWorkspacesOpen(String msg, boolean allowScopedOut) throws ND4JWorkspaceException
Assert that no workspaces are currently open- Parameters:
msg
- Message to include in the exception, if requiredallowScopedOut
- If true: don't fail if we have an open workspace but are currently scoped out- Throws:
ND4JWorkspaceException
-
assertOpenAndActive
public static void assertOpenAndActive(@NonNull @NonNull String ws, @NonNull @NonNull String errorMsg) throws ND4JWorkspaceException
Assert that the specified workspace is open and active- Parameters:
ws
- Name of the workspace to assert open and activeerrorMsg
- Message to include in the exception, if required- Throws:
ND4JWorkspaceException
-
assertOpenActiveAndCurrent
public static void assertOpenActiveAndCurrent(@NonNull @NonNull String ws, @NonNull @NonNull String errorMsg) throws ND4JWorkspaceException
Assert that the specified workspace is open, active, and is the current workspace- Parameters:
ws
- Name of the workspace to assert open/active/currenterrorMsg
- Message to include in the exception, if required- Throws:
ND4JWorkspaceException
-
assertValidArray
public static void assertValidArray(INDArray array, String msg)
Assert that the specified array is valid, in terms of workspaces: i.e., if it is attached (and not in a circular workspace), assert that the workspace is open, and that the data is not from an old generation.- Parameters:
array
- Array to checkmsg
- Message (prefix) to include in the exception, if required. May be null
-
-