2) Caffe2 Workspace [WIP]

PyBind State

map> gWorkspaces

Global workspace dict: Workspace name => Workspace unique_ptr.

There is a "default" workspace instance transparently instantiated for you.

Workspace* gWorkspace

Global current workspace pointer.

Could be returned by Workspace* GetCurrentWorkspace().

string gCurrentWorkspaceName

Global current workspace name.

switchWorkspaceInternal(string name, bool create_if_missing)

Query workspace name in gWorkspaces.

If not found, create a new workspace with the given name or throw CAFFE_ENFORCE exception.

If found, update both gWorkspace and gCurrentWorkspaceName.

Current Workspace instance

workspace.FeedBlob(blob_name: str, value: array) -> bool

workspace.FetchBlob(blob_name: str) -> array

Referenced Workspace instance

workspace.C.Workspace(...)

Create a Workspace C++ instance. See example here.

If another Workspace is passed to the constructor, that passed Workspace is the parent of the new Workspace to be initialized. See example here. Implementation details: 1. Binding. 2. C++ Constructor.

ws.run(...)

A Workspace can run Plan, Net, Operator.

你可能感兴趣的:(2) Caffe2 Workspace [WIP])