2) Caffe2 Workspace [WIP]

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.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Lua 5.1 参考手册 by Roberto Ierusalimschy, Luiz Henrique de F...
    苏黎九歌阅读 13,918评论 0 38
  • pyspark.sql模块 模块上下文 Spark SQL和DataFrames的重要类: pyspark.sql...
    mpro阅读 9,505评论 0 13
  • NAME dnsmasq - A lightweight DHCP and caching DNS server....
    ximitc阅读 2,936评论 0 0
  • 谚云:祸从口出。 古往今来,因言坏事者比比皆是。 想做个会说好话,少说错话的有心人, “三愆”的学问,便不可不知。...
    老斯基酱阅读 237评论 0 0
  • 有一个地方 他活着,只有一个使命。 抛开一切,只为守护那个她。 不求回报,不要结果,不离不弃,不死不休。。。。
    小紫大大与法师哥哥阅读 146评论 0 0