{
auto *graph = origin->graph();
- auto dec = make_feature_decode<DefaultLayout::NHWC>(origin->ifm());
+ auto dec = make_feature_decode<FeatureLayout::NHWC>(origin->ifm());
auto tfl_average = graph->nodes()->create<locoex::TFLAveragePool2D>();
{
tfl_average->value(dec);
tfl_average->fusedActivationFunction(locoex::FusedActFunc::NONE);
}
- auto enc = make_feature_encode<DefaultLayout::NHWC>(tfl_average);
+ auto enc = make_feature_encode<FeatureLayout::NHWC>(tfl_average);
// replace canonical node
loco::replace(origin).with(enc);
// let's create a new graph connection with tfl_conv2d
{
// input
- auto feature_dec = make_feature_decode<DefaultLayout::NHWC>(origin->ifm());
+ auto feature_dec = make_feature_decode<FeatureLayout::NHWC>(origin->ifm());
tfl_conv2d->input(feature_dec);
// filter
tfl_conv2d->bias(zero_const);
// output
- auto feature_enc = make_feature_encode<DefaultLayout::NHWC>(tfl_conv2d);
+ auto feature_enc = make_feature_encode<FeatureLayout::NHWC>(tfl_conv2d);
// replace canonical node
loco::replace(origin).with(feature_enc);
loco::EltwiseBin (dead node)
*/
auto graph = origin->graph();
- auto dec_l = make_feature_decode<DefaultLayout::NHWC>(origin->lhs());
- auto dec_r = make_feature_decode<DefaultLayout::NHWC>(origin->rhs());
+ auto dec_l = make_feature_decode<FeatureLayout::NHWC>(origin->lhs());
+ auto dec_r = make_feature_decode<FeatureLayout::NHWC>(origin->rhs());
auto tfl_new = graph->nodes()->template create<TFLBIN>();
{
tfl_new->x(dec_l);
tfl_new->y(dec_r);
}
- auto enc = make_feature_encode<DefaultLayout::NHWC>(tfl_new);
+ auto enc = make_feature_encode<FeatureLayout::NHWC>(tfl_new);
loco::replace(origin).with(enc);
origin->lhs(nullptr);
// handling input x
assert(loco::shape_get(origin->value()).domain() == loco::Domain::Feature);
- auto fea_dec = make_feature_decode<DefaultLayout::NHWC>(origin->value());
+ auto fea_dec = make_feature_decode<FeatureLayout::NHWC>(origin->value());
tfl_add->x(fea_dec);
// handling input y
tfl_add->y(bias_dec);
// handling output
- auto fea_enc = make_feature_encode<DefaultLayout::NHWC>(tfl_add);
+ auto fea_enc = make_feature_encode<FeatureLayout::NHWC>(tfl_add);
loco::replace(origin).with(fea_enc);
origin->value(nullptr);
{
auto *graph = origin->graph();
- auto dec = make_feature_decode<DefaultLayout::NHWC>(origin->ifm());
+ auto dec = make_feature_decode<FeatureLayout::NHWC>(origin->ifm());
auto tfl_max = graph->nodes()->create<locoex::TFLMaxPool2D>();
{
tfl_max->value(dec);
tfl_max->fusedActivationFunction(locoex::FusedActFunc::NONE);
}
- auto enc = make_feature_encode<DefaultLayout::NHWC>(tfl_max);
+ auto enc = make_feature_encode<FeatureLayout::NHWC>(tfl_max);
loco::replace(origin).with(enc);
origin->ifm(nullptr);
loco::ReLU (dead node)
*/
auto graph = origin->graph();
- auto dec = make_feature_decode<DefaultLayout::NHWC>(origin->input());
+ auto dec = make_feature_decode<FeatureLayout::NHWC>(origin->input());
auto tfl_relu = graph->nodes()->create<locoex::TFLRelu>();
{
tfl_relu->features(dec);
}
- auto enc = make_feature_encode<DefaultLayout::NHWC>(tfl_relu);
+ auto enc = make_feature_encode<FeatureLayout::NHWC>(tfl_relu);
loco::replace(origin).with(enc);
origin->input(nullptr);
// g = Pull - FeatureEncode - Relu - FeatureDecode - Push
exo::test::TestGraph graph;
{
- auto enc = exo::make_feature_encode<exo::DefaultLayout::NHWC>(graph.pull);
+ auto enc = exo::make_feature_encode<exo::FeatureLayout::NHWC>(graph.pull);
auto relu = graph.append<loco::ReLU>(enc);
- auto dec = exo::make_feature_decode<exo::DefaultLayout::NHWC>(relu);
+ auto dec = exo::make_feature_decode<exo::FeatureLayout::NHWC>(relu);
graph.complete(dec);
}
namespace
{
-template <exo::DefaultLayout T> loco::Permutation<loco::Domain::Feature> perm();
+template <exo::FeatureLayout T> loco::Permutation<loco::Domain::Feature> perm();
-template <> loco::Permutation<loco::Domain::Feature> perm<exo::DefaultLayout::NHWC>()
+template <> loco::Permutation<loco::Domain::Feature> perm<exo::FeatureLayout::NHWC>()
{
// Make NHWC permutation for encoder and decoder
loco::Permutation<loco::Domain::Feature> NHWC;
namespace exo
{
-template <DefaultLayout T> loco::FeatureEncode *make_feature_encode(loco::Node *input_for_encode)
+template <FeatureLayout T> loco::FeatureEncode *make_feature_encode(loco::Node *input_for_encode)
{
EXO_ASSERT(input_for_encode != nullptr, "input should not be nullptr");
loco::Graph *g = input_for_encode->graph();
return enc;
}
-template <DefaultLayout T> loco::FeatureDecode *make_feature_decode(loco::Node *input_for_decode)
+template <FeatureLayout T> loco::FeatureDecode *make_feature_decode(loco::Node *input_for_decode)
{
EXO_ASSERT(input_for_decode != nullptr, "input should not be nullptr");
loco::Graph *g = input_for_decode->graph();
// template instantiation
template loco::FeatureEncode *
-make_feature_encode<DefaultLayout::NHWC>(loco::Node *input_for_encode);
+make_feature_encode<FeatureLayout::NHWC>(loco::Node *input_for_encode);
template loco::FeatureDecode *
-make_feature_decode<DefaultLayout::NHWC>(loco::Node *input_for_encode);
+make_feature_decode<FeatureLayout::NHWC>(loco::Node *input_for_encode);
template loco::FilterEncode *make_filter_encode<FilterLayout::HWIO>(loco::Node *input_for_encode);
template loco::FilterDecode *make_filter_decode<FilterLayout::OHWI>(loco::Node *input_for_decode);
namespace exo
{
-/// @brief default layout of TFLITE file
-enum class DefaultLayout
+/// @brief feature layout of TFLITE file
+enum class FeatureLayout
{
NHWC,
};
-/// @brief Creates a loco::FeatureEncode of default layout (NHWC for tflite) and add it to graph.
-template <DefaultLayout T> loco::FeatureEncode *make_feature_encode(loco::Node *input_for_encode);
+/// @brief Creates a loco::FeatureEncode with T layout (NHWC for tflite) and add it to graph.
+template <FeatureLayout T> loco::FeatureEncode *make_feature_encode(loco::Node *input_for_encode);
-/// @brief Create a loco::FeatureDecode of default layout (NHWC for tflite) and add it to graph.
-template <DefaultLayout T> loco::FeatureDecode *make_feature_decode(loco::Node *input_for_decode);
+/// @brief Creates a loco::FeatureDecode with T layout (NHWC for tflite) and add it to graph.
+template <FeatureLayout T> loco::FeatureDecode *make_feature_decode(loco::Node *input_for_decode);
enum class FilterLayout
{
pull->shape({1, 8, 8, 3});
}
auto relu = make_node<loco::ReLU>();
- auto encode = exo::make_feature_encode<exo::DefaultLayout::NHWC>(pull);
+ auto encode = exo::make_feature_encode<exo::FeatureLayout::NHWC>(pull);
auto maxpool = make_node<loco::MaxPool2D>();
- auto decode = exo::make_feature_decode<exo::DefaultLayout::NHWC>(relu);
+ auto decode = exo::make_feature_decode<exo::FeatureLayout::NHWC>(relu);
auto push = make_node<loco::Push>();
ASSERT_EQ(maxpool->window()->vertical(), 1);
void build()
{
- fea_enc = exo::make_feature_encode<exo::DefaultLayout::NHWC>(pull);
+ fea_enc = exo::make_feature_encode<exo::FeatureLayout::NHWC>(pull);
constgen = append<loco::ConstGen>();
bias_enc = append<loco::BiasEncode>(constgen);
fea_bias_add = append<loco::FeatureBiasAdd>(fea_enc, bias_enc);
- fea_dec = exo::make_feature_decode<exo::DefaultLayout::NHWC>(fea_bias_add);
+ fea_dec = exo::make_feature_decode<exo::FeatureLayout::NHWC>(fea_bias_add);
complete(fea_dec);
}
};