summaryrefslogtreecommitdiff
path: root/inference-engine/src/gna_plugin/dnn_traits.hpp
blob: 0a92bb342013b3fdb8cee072708299f6f6ede8d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Copyright (C) 2018 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#pragma once

#include "dnn.h"

template<intel_dnn_operation_t layer>
struct DnnTrait {};

template<>
struct DnnTrait<kDnnDiagonalOp> {
    using Type = intel_affine_t;
    static Type *getLayer(intel_dnn_component_t &component) {
        return &component.op.affine;
    }
};

template<>
struct DnnTrait<kDnnPiecewiselinearOp> {
    using Type = intel_piecewiselinear_t;
    static Type *getLayer(intel_dnn_component_t &component) {
        return &component.op.pwl;
    }
};

template<>
struct DnnTrait<kDnnAffineOp> {
    using Type = intel_affine_t;
    static Type *getLayer(intel_dnn_component_t &component) {
        return &component.op.affine;
    }
};

template<>
struct DnnTrait<kDnnConvolutional1dOp> {
    using Type = intel_convolutionalD_t;
    static Type *getLayer(intel_dnn_component_t &component) {
        return &component.op.conv1D;
    }
};

template<>
struct DnnTrait<kDnnMaxPoolOp> {
    using Type = intel_maxpool_t;
    static Type *getLayer(intel_dnn_component_t &component) {
        return &component.op.maxpool;
    }
};

template<>
struct DnnTrait<kDnnRecurrentOp> {
    using Type = intel_recurrent_t;
    static Type *getLayer(intel_dnn_component_t &component) {
        return &component.op.recurrent;
    }
};

template<>
struct DnnTrait<kDnnInterleaveOp> {
    using Type = intel_interleave_t;
    static Type *getLayer(intel_dnn_component_t &component) {
        return &component.op.interleave;
    }
};

template<>
struct DnnTrait<kDnnDeinterleaveOp> {
    using Type = intel_deinterleave_t;
    static Type *getLayer(intel_dnn_component_t &component) {
        return &component.op.deinterleave;
    }
};

template<>
struct DnnTrait<kDnnCopyOp> {
    using Type = intel_copy_t;
    static Type *getLayer(intel_dnn_component_t &component) {
        return &component.op.copy;
    }
};

template<>
struct DnnTrait<kDnnNullOp> {
    using Type = void;
    static Type *getLayer(intel_dnn_component_t &component) {
        return nullptr;
    }
};