ArmNN
 20.05
armnnCaffeParser Namespace Reference

Caffe networks are loaded from protobuf files (binary or text) using the protobuf library and the generated code from caffe.pb.h. More...

Classes

class  CaffeParser
 
class  CaffeParserBase
 
class  ICaffeParser
 
class  RecordByRecordCaffeParser
 

Typedefs

using BindingPointInfo = armnn::BindingPointInfo
 
using ICaffeParserPtr = std::unique_ptr< ICaffeParser, void(*)(ICaffeParser *parser)>
 

Functions

BlobShape TensorDescToBlobShape (const TensorInfo &desc)
 

Detailed Description

Caffe networks are loaded from protobuf files (binary or text) using the protobuf library and the generated code from caffe.pb.h.

This gives us a caffe::NetParameter which is an in-memory version of the file. This contains a flat list of Caffe 'layers' (e.g. convolution, pooling etc.). Each layer has inputs (called "bottoms") and outputs (called "tops"). Data flows from bottom to top. The bottoms of a layer refer to the tops of other layers, not their names. The names of layers seem to be arbitrary (you could rename a layer and the network wouldn't need any other changes).

Some layers (e.g. Relu) can be configured so that their top and bottom are both the same. This is called an "in-place" layer and is a Caffe runtime feature used to reduce memory usage by modifying tensors in-place. This isn't relevant to the parser and so we preprocess these layers to convert them to regular layers, to result in a consistent graph structure.

Typedef Documentation

◆ BindingPointInfo

Definition at line 19 of file ICaffeParser.hpp.

◆ ICaffeParserPtr

using ICaffeParserPtr = std::unique_ptr<ICaffeParser, void(*)(ICaffeParser* parser)>

Definition at line 22 of file ICaffeParser.hpp.

Function Documentation

◆ TensorDescToBlobShape()

BlobShape armnnCaffeParser::TensorDescToBlobShape ( const TensorInfo desc)

Definition at line 326 of file CaffeParser.cpp.

References TensorInfo::GetNumDimensions(), and TensorInfo::GetShape().

Referenced by CaffeParserBase::AddConvLayerWithDepthwiseConv(), CaffeParserBase::AddConvLayerWithSplits(), and CaffeParserBase::ParseConvLayer().

327 {
328  BlobShape ret;
329  for (unsigned int i = 0; i < desc.GetNumDimensions(); ++i)
330  {
331  ret.add_dim(i);
332  ret.set_dim(boost::numeric_cast<int>(i), desc.GetShape()[i]);
333  }
334 
335  return ret;
336 }
const TensorShape & GetShape() const
Definition: Tensor.hpp:88
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:92