2) Caffe2 Workspace [WIP]

2018-07-31  本文已影响14人  Hexus

PyBind State

map<string, unique_ptr<Workspace>> 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.

上一篇 下一篇

猜你喜欢

热点阅读