ONE - On-device Neural Engine
Loading...
Searching...
No Matches
caffeimport::InputBuilder Class Referencefinal

#include <Input.h>

Collaboration diagram for caffeimport::InputBuilder:

Public Member Functions

void build (const ::caffe::LayerParameter &layer, GraphBuilderContext *context) const override
 
- Public Member Functions inherited from caffeimport::GraphBuilder
virtual ~GraphBuilder ()
 

Detailed Description

Definition at line 27 of file Input.h.

Member Function Documentation

◆ build()

void caffeimport::InputBuilder::build ( const ::caffe::LayerParameter &  layer,
GraphBuilderContext context 
) const
overridevirtual

Implements caffeimport::GraphBuilder.

Definition at line 32 of file Input.cpp.

33{
34 coco::Module *module = context->module();
35 std::map<std::string, tensor::Shape> &shape_ctx = context->shape_ctx();
36 std::map<std::string, coco::Bag *> &bag_ctx = context->bag_ctx();
37
38 assert(layer.has_input_param());
39 const auto &param = layer.input_param();
40
41 for (uint32_t n = 0; n < layer.top_size(); ++n)
42 {
43 const auto &name = layer.top(n);
44 const auto shape = as_tensor_shape(param.shape(n));
45
46 auto bag = module->entity()->bag()->create(num_elements(shape));
47 auto input = module->entity()->input()->create(shape);
48
49 input->bag(bag);
50 input->name(name);
51 input->reorder<LexicalLayout>();
52
53 module->input()->insert(input);
54
55 bag_ctx[name] = bag;
56 shape_ctx[name] = shape;
57 }
58}
Top-level element of coco IR which represents a neural network.
Definition Module.h:34
tensor::Shape as_tensor_shape(const ::caffe::BlobShape &blob_shape)
Definition Convert.cpp:24

References caffeimport::as_tensor_shape(), caffeimport::GraphBuilderContext::bag_ctx(), and caffeimport::GraphBuilderContext::shape_ctx().


The documentation for this class was generated from the following files: