17#ifndef __GRAPH_BUILDER_H__
18#define __GRAPH_BUILDER_H__
61 std::stack<loco::Node *> _content;
89 template <
typename Layer,
typename... Args>
91 ->
decltype(
static_cast<Layer *
>(
nullptr)->
operator()(
static_cast<Context *
>(
nullptr)))
93 Layer layer{std::forward<Args>(args)...};
101 Context *ctx(
void) {
return &_context; }
107static inline std::unique_ptr<GraphBuilder> make_graph_builder(
loco::Graph *g)
109 return std::make_unique<GraphBuilder>(g);
154 pull_node->
index(input_index);
160 return std::make_unique<Return>(graph_input, pull_node);
183 _output->name(value);
200 push_node->
index(output_index);
206 return std::make_unique<Return>(graph_output, push_node);
237 return std::make_unique<Return>(relu_node);
264 return std::make_unique<Return>(const_node);
283 using namespace loco;
303 return std::make_unique<Return>(encode_node);
320 using namespace loco;
334 using namespace loco;
342 return std::make_unique<Return>(decode_node);
359 auto encoder = std::make_unique<loco::PermutingEncoder<loco::Domain::Filter>>();
361 _node->
encoder(std::move(encoder));
380 return std::make_unique<Return>(encode_node);
397 using namespace loco;
417 return std::make_unique<Return>(encode_node);
443 depthwiseconv2d_node->ifm(ctx->
stack()->
pop());
445 ctx->
stack()->
push(depthwiseconv2d_node);
447 return std::make_unique<Return>(depthwiseconv2d_node);
473 tr_conv2d_node->ifm(ctx->
stack()->
pop());
477 return std::make_unique<Return>(tr_conv2d_node);
513 return std::make_unique<Return>(reshape_node);
541 return std::make_unique<Return>(broadcast_node);
loco::ConstGen * node(void)
Return(loco::ConstGen *node)
loco::DepthwiseConv2D * node(void)
Return(loco::DepthwiseConv2D *node)
Return * perm(const loco::Permutation< loco::Domain::DepthwiseFilter > &perm)
Return(loco::DepthwiseFilterEncode *node)
loco::DepthwiseFilterEncode * node(void)
Return(loco::FeatureDecode *node)
Return * perm(const loco::Permutation< loco::Domain::Feature > &perm)
loco::FeatureDecode * node(void)
Return(loco::FeatureEncode *node)
loco::FeatureEncode * node(void)
Return * perm(const loco::Permutation< loco::Domain::Feature > &perm)
Return * perm(const loco::Permutation< loco::Domain::Filter > &perm)
Return(loco::FilterEncode *node)
loco::FilterEncode * node(void)
loco::FixedReshape * node(void)
Return * shape(std::initializer_list< uint32_t > dims)
Return(loco::FixedReshape *node)
loco::Graph * graph(void)
Context(loco::Graph *graph)
void push(loco::Node *node)
loco::Node * top(void) const
GraphBuilder(loco::Graph *graph)
auto push(Args &&...args) -> decltype(static_cast< Layer * >(nullptr) ->operator()(static_cast< Context * >(nullptr)))
Return * name(const std::string &value)
Return(loco::GraphOutput *output, loco::Push *node)
Return(loco::TensorBroadcast *node)
loco::TensorBroadcast * node(void)
Return(loco::TransposedConv2D *node)
loco::TransposedConv2D * node(void)
Create a value from constant byte array.
Depthwise 2D Convolution.
Create a depthwise filter from a tensor.
DepthwiseFilterEncoder * encoder(void) const
Create a tensor from a feature map.
FeatureDecoder * decoder(void) const
Create a feature map from a tensor.
FeatureEncoder * encoder(void) const
Create a filter from a tensor.
FilterEncoder * encoder(void) const
InputContext * inputs(void)
NodeContext * nodes(void)
OutputContext * outputs(void)
Graph-level Output Metadata.
Logical unit of computation.
Derived * create(Args &&...args)
uint32_t size(void) const
Return the number of objects.
Create a value from user data.
void index(const GraphInputIndex &index)
Make a value visible to user.
void index(const GraphOutputIndex &index)
Create a new value that rectifies its input.
Reshape a tensor to another tensor whose shape is known at compile time.
Duplicate elements along specified axes.
2D Transposed Convolution
void link(GraphOutput *, Push *push)
std::unique_ptr< Return > operator()(GraphBuilder::Context *ctx)
std::unique_ptr< Return > operator()(GraphBuilder::Context *ctx)
std::unique_ptr< Return > operator()(GraphBuilder::Context *ctx)
std::unique_ptr< Return > operator()(GraphBuilder::Context *ctx)
std::unique_ptr< Return > operator()(GraphBuilder::Context *ctx)
std::unique_ptr< Return > operator()(GraphBuilder::Context *ctx)
std::unique_ptr< Return > operator()(GraphBuilder::Context *ctx)
std::unique_ptr< Return > operator()(GraphBuilder::Context *ctx)
std::unique_ptr< Return > operator()(GraphBuilder::Context *ctx)
std::unique_ptr< Return > operator()(GraphBuilder::Context *ctx)
std::unique_ptr< Return > operator()(GraphBuilder::Context *ctx)
GraphInput * create(void)
GraphOutput * create(void)