1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
4 // dnn_traits.hpp : c++ trait approach to define dnn objects
11 template<intel_dnn_operation_t layer>
15 struct DnnTrait<kDnnDiagonalOp> {
16 using Type = intel_affine_t;
17 static Type *getLayer(intel_dnn_component_t &component) {
18 return &component.op.affine;
23 struct DnnTrait<kDnnPiecewiselinearOp> {
24 using Type = intel_piecewiselinear_t;
25 static Type *getLayer(intel_dnn_component_t &component) {
26 return &component.op.pwl;
31 struct DnnTrait<kDnnAffineOp> {
32 using Type = intel_affine_t;
33 static Type *getLayer(intel_dnn_component_t &component) {
34 return &component.op.affine;
39 struct DnnTrait<kDnnConvolutional1dOp> {
40 using Type = intel_convolutionalD_t;
41 static Type *getLayer(intel_dnn_component_t &component) {
42 return &component.op.conv1D;
47 struct DnnTrait<kDnnMaxPoolOp> {
48 using Type = intel_maxpool_t;
49 static Type *getLayer(intel_dnn_component_t &component) {
50 return &component.op.maxpool;
55 struct DnnTrait<kDnnRecurrentOp> {
56 using Type = intel_recurrent_t;
57 static Type *getLayer(intel_dnn_component_t &component) {
58 return &component.op.recurrent;
63 struct DnnTrait<kDnnInterleaveOp> {
64 using Type = intel_interleave_t;
65 static Type *getLayer(intel_dnn_component_t &component) {
66 return &component.op.interleave;
71 struct DnnTrait<kDnnDeinterleaveOp> {
72 using Type = intel_deinterleave_t;
73 static Type *getLayer(intel_dnn_component_t &component) {
74 return &component.op.deinterleave;
79 struct DnnTrait<kDnnCopyOp> {
80 using Type = intel_copy_t;
81 static Type *getLayer(intel_dnn_component_t &component) {
82 return &component.op.copy;
87 struct DnnTrait<kDnnNullOp> {
89 static Type *getLayer(intel_dnn_component_t &component) {