Module caffe2.python.workspace. More...
Classes | |
| class | _BlobDict |
Functions | |
| def | GetCudaPeerAccessPattern () |
| def | StartMint (root_folder=None, port=None) |
| def | StringifyProto (obj) |
| def | ResetWorkspace (root_folder=None) |
| def | CreateNet (net, overwrite=False, input_blobs=None) |
| def | RunOperatorOnce (operator) |
| def | RunOperatorsOnce (operators) |
| def | RunNetOnce (net) |
| def | RunNet (name, num_iter=1) |
| def | RunPlan (plan_or_step) |
| def | InferShapesAndTypes (nets, blob_dimensions=None) |
| def | StringifyBlobName (name) |
| def | StringifyNetName (name) |
| def | FeedBlob (name, arr, device_option=None) |
| def | FetchBlobs (names) |
| def | FetchBlob (name) |
| def | GetNameScope () |
| def | IsImmediate () |
| def | WorkspaceGuard (workspace_name) |
| def | StartImmediate (i_know=False) |
| def | StopImmediate () |
| def | ImmediateBlobs () |
| def | RunOperatorImmediate (op) |
| def | FetchImmediate (args, kwargs) |
| def | FeedImmediate (args, kwargs) |
Variables | |
| logger = logging.getLogger(__name__) | |
| Blobs = C.blobs | |
| CreateBlob = C.create_blob | |
| CurrentWorkspace = C.current_workspace | |
| DeserializeBlob = C.deserialize_blob | |
| GlobalInit = C.global_init | |
| HasBlob = C.has_blob | |
| RegisteredOperators = C.registered_operators | |
| SerializeBlob = C.serialize_blob | |
| SwitchWorkspace = C.switch_workspace | |
| RootFolder = C.root_folder | |
| Workspaces = C.workspaces | |
| BenchmarkNet = C.benchmark_net | |
| Predictor = C.Predictor | |
| is_asan = C.is_asan | |
| has_gpu_support = C.has_gpu_support | |
| NumCudaDevices = C.num_cuda_devices | |
| SetDefaultGPUID = C.set_default_gpu_id | |
| GetDefaultGPUID = C.get_default_gpu_id | |
| GetCuDNNVersion = C.get_cudnn_version | |
| GetCudaPeerAccessPattern = lambda: np.array([]) | |
| basestring = str | |
| blobs = _BlobDict() | |
Module caffe2.python.workspace.
| def workspace.FeedBlob | ( | name, | |
| arr, | |||
device_option = None |
|||
| ) |
Feeds a blob into the workspace.
Inputs:
name: the name of the blob.
arr: either a TensorProto object or a numpy array object to be fed into
the workspace.
device_option (optional): the device option to feed the data with.
Returns:
True or False, stating whether the feed is successful.
Definition at line 229 of file workspace.py.
| def workspace.FetchBlob | ( | name | ) |
Fetches a blob from the workspace. Inputs: name: the name of the blob - a string or a BlobReference Returns: Fetched blob (numpy array or string) if successful
Definition at line 276 of file workspace.py.
| def workspace.FetchBlobs | ( | names | ) |
Fetches a list of blobs from the workspace.
Inputs:
names: list of names of blobs - strings or BlobReferences
Returns:
list of fetched blobs
Definition at line 265 of file workspace.py.
| def workspace.GetNameScope | ( | ) |
Return the current namescope string. To be used to fetch blobs
Definition at line 287 of file workspace.py.
| def workspace.InferShapesAndTypes | ( | nets, | |
blob_dimensions = None |
|||
| ) |
Infers the shapes and types for the specified nets.
Inputs:
nets: the list of nets
blob_dimensions (optional): a dictionary of blobs and their dimensions.
If not specified, the workspace blobs are used.
Returns:
A tuple of (shapes, types) dictionaries keyed by blob name.
Definition at line 184 of file workspace.py.
| def workspace.RunNet | ( | name, | |
num_iter = 1 |
|||
| ) |
Runs a given net. Inputs: name: the name of the net, or a reference to the net. num_iter: number of iterations to run Returns: True or an exception.
Definition at line 164 of file workspace.py.
| def workspace.StartMint | ( | root_folder = None, |
|
port = None |
|||
| ) |
Start a mint instance.
TODO(Yangqing): this does not work well under ipython yet. According to
https://github.com/ipython/ipython/issues/5862
writing up some fix is a todo item.
Definition at line 81 of file workspace.py.
| def workspace.StopImmediate | ( | ) |
Stops an immediate mode run.
Definition at line 401 of file workspace.py.
| def workspace.StringifyProto | ( | obj | ) |
Stringify a protocol buffer object.
Inputs:
obj: a protocol buffer object, or a Pycaffe2 object that has a Proto()
function.
Outputs:
string: the output protobuf string.
Raises:
AttributeError: if the passed in object does not have the right attribute.
Definition at line 105 of file workspace.py.
1.8.14