Caffe2 - Python API
A deep learning, cross platform ML framework
Classes | Functions | Variables
utils Namespace Reference

Module caffe2.python.utils. More...

Classes

class  DebugMode
 

Functions

def CaffeBlobToNumpyArray (blob)
 
def Caffe2TensorToNumpyArray (tensor)
 
def NumpyArrayToCaffe2Tensor (arr, name=None)
 
def MakeArgument (key, value)
 
def TryReadProtoWithClass (cls, s)
 
def GetContentFromProto (obj, function_map)
 
def GetContentFromProtoString (s, function_map)
 
def ConvertProtoToBinary (proto_class, filename, out_filename)
 
def debug (f)
 

Variables

 basestring = str
 
 long = int
 

Detailed Description

Module caffe2.python.utils.

Function Documentation

◆ ConvertProtoToBinary()

def utils.ConvertProtoToBinary (   proto_class,
  filename,
  out_filename 
)
Convert a text file of the given protobuf class to binary.

Definition at line 147 of file utils.py.

◆ debug()

def utils.debug (   f)
Use this method to decorate your function with DebugMode's functionality

Example:

@debug
def test_foo(self):
    raise Exception("Bar")

Definition at line 190 of file utils.py.

◆ GetContentFromProto()

def utils.GetContentFromProto (   obj,
  function_map 
)
Gets a specific field from a protocol buffer that matches the given class

Definition at line 128 of file utils.py.

◆ MakeArgument()

def utils.MakeArgument (   key,
  value 
)
Makes an argument based on the value type.

Definition at line 66 of file utils.py.

◆ TryReadProtoWithClass()

def utils.TryReadProtoWithClass (   cls,
  s 
)
Reads a protobuffer with the given proto class.

Inputs:
  cls: a protobuffer class.
  s: a string of either binary or text protobuffer content.

Outputs:
  proto: the protobuffer of cls

Throws:
  google.protobuf.message.DecodeError: if we cannot decode the message.

Definition at line 106 of file utils.py.