Map [NNRT-824]LeakyRelu/[NNRT-817]LogicalOr/And/[NNRT-831]GatherNd
Signed-off-by: yuenan.li <yuenan.li@verisilicon.com>
This commit is contained in:
parent
bcae0571f0
commit
0e422b1e6a
|
|
@ -53,6 +53,14 @@ class Prelu : public Operation {
|
|||
int axis_;
|
||||
};
|
||||
|
||||
class LeakyRelu : public Operation {
|
||||
public:
|
||||
LeakyRelu(Graph* graph, float alpha);
|
||||
|
||||
protected:
|
||||
float alpha_;
|
||||
};
|
||||
|
||||
} // namespace ops
|
||||
} // namespace vx
|
||||
} // namespace tim
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
namespace tim {
|
||||
namespace vx {
|
||||
|
||||
namespace ops {
|
||||
|
||||
class DepthToSpace : public Operation {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
namespace tim {
|
||||
namespace vx {
|
||||
|
||||
namespace ops {
|
||||
|
||||
class Gather : public Operation {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2020 Vivante Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef TIM_VX_OPS_GATHERND_H_
|
||||
#define TIM_VX_OPS_GATHERND_H_
|
||||
#include "tim/vx/operation.h"
|
||||
|
||||
namespace tim {
|
||||
namespace vx {
|
||||
namespace ops {
|
||||
|
||||
class GatherNd : public Operation {
|
||||
public:
|
||||
GatherNd(Graph* Graph);
|
||||
};
|
||||
|
||||
} // namespace ops
|
||||
} // namespace vx
|
||||
} // namespace tim
|
||||
|
||||
#endif /* TIM_VX_OPS_GATHERND_H_ */
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2020 Vivante Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef TIM_VX_OPS_LOGICAL_H_
|
||||
#define TIM_VX_OPS_LOGICAL_H_
|
||||
#include "tim/vx/operation.h"
|
||||
|
||||
namespace tim {
|
||||
namespace vx {
|
||||
namespace ops {
|
||||
|
||||
#define DELCATE_LOGICAL_OP(NAME) \
|
||||
class Logical##NAME : public Operation { \
|
||||
public: \
|
||||
Logical##NAME(Graph* graph); \
|
||||
};
|
||||
|
||||
DELCATE_LOGICAL_OP(And);
|
||||
DELCATE_LOGICAL_OP(Or);
|
||||
|
||||
#undef DELCATE_LOGICAL_OP
|
||||
|
||||
} // namespace ops
|
||||
} // namespace vx
|
||||
} // namespace tim
|
||||
|
||||
#endif /* TIM_VX_OPS_ACTIVATIONS_H_ */
|
||||
|
|
@ -46,7 +46,7 @@ DELCATE_REDUCE_OP(Any);
|
|||
DELCATE_REDUCE_OP(Prod);
|
||||
DELCATE_REDUCE_OP(Mean);
|
||||
|
||||
#undef DEFINE_REDUCE_OP
|
||||
#undef DELCATE_REDUCE_OP
|
||||
|
||||
} // namespace ops
|
||||
} // namespace vx
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2020 Vivante Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef TIM_VX_OPS_REVERSE_H_
|
||||
#define TIM_VX_OPS_REVERSE_H_
|
||||
#include "tim/vx/operation.h"
|
||||
|
||||
namespace tim {
|
||||
namespace vx {
|
||||
namespace ops {
|
||||
|
||||
class Reverse : public Operation {
|
||||
public:
|
||||
Reverse(Graph* graph, int32_t* axis, uint32_t axis_num);
|
||||
|
||||
protected:
|
||||
int32_t* axis_;
|
||||
uint32_t axis_num_;
|
||||
};
|
||||
|
||||
} // namespace ops
|
||||
} // namespace vx
|
||||
} // namespace tim
|
||||
|
||||
#endif /* TIM_VX_OPS_REVERSE_H_ */
|
||||
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
namespace tim {
|
||||
namespace vx {
|
||||
|
||||
namespace ops {
|
||||
|
||||
class SpaceToDepth : public Operation {
|
||||
|
|
|
|||
|
|
@ -56,6 +56,11 @@ Tanh::Tanh(Graph* graph) : Operation(graph, VSI_NN_OP_TANH) {
|
|||
this->impl()->node()->nn_param.tanh.scale_b = 1.0;
|
||||
}
|
||||
|
||||
LeakyRelu::LeakyRelu(Graph* graph, float alpha)
|
||||
: Operation(graph, VSI_NN_OP_LEAKY_RELU), alpha_(alpha) {
|
||||
this->impl()->node()->nn_param.activation.leaky_ratio = alpha_;
|
||||
}
|
||||
|
||||
} // namespace ops
|
||||
} // namespace vx
|
||||
} // namespace tim
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
|
||||
namespace tim {
|
||||
namespace vx {
|
||||
|
||||
namespace ops {
|
||||
|
||||
DepthToSpace::DepthToSpace(Graph* graph, int block_size)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
|
||||
namespace tim {
|
||||
namespace vx {
|
||||
|
||||
namespace ops {
|
||||
|
||||
Gather::Gather(Graph* graph, int axis)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2020 Vivante Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include "tim/vx/ops/gathernd.h"
|
||||
|
||||
#include "operation_private.h"
|
||||
#include "vsi_nn_pub.h"
|
||||
|
||||
namespace tim {
|
||||
namespace vx {
|
||||
namespace ops {
|
||||
|
||||
GatherNd::GatherNd(Graph* graph) : Operation(graph, VSI_NN_OP_GATHER_ND) {}
|
||||
} // namespace ops
|
||||
} // namespace vx
|
||||
} // namespace tim
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2020 Vivante Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include "tim/vx/ops/logical.h"
|
||||
|
||||
#include "operation_private.h"
|
||||
#include "vsi_nn_pub.h"
|
||||
|
||||
namespace tim {
|
||||
namespace vx {
|
||||
namespace ops {
|
||||
|
||||
#define DEFINE_LOGICAL_OP(NAME, VSI_OP_CODE) \
|
||||
Logical##NAME::Logical##NAME(Graph* graph) \
|
||||
: Operation(graph, VSI_NN_OP_LOGICAL_OPS) { \
|
||||
this->impl()->node()->nn_param.relational_ops.op = \
|
||||
VSI_NN_LOGICAL_##VSI_OP_CODE; \
|
||||
}
|
||||
|
||||
DEFINE_LOGICAL_OP(And, AND);
|
||||
DEFINE_LOGICAL_OP(Or, OR);
|
||||
|
||||
#undef DEFINE_LOGICAL_OP
|
||||
|
||||
} // namespace ops
|
||||
} // namespace vx
|
||||
} // namespace tim
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2020 Vivante Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include "tim/vx/ops/reverse.h"
|
||||
|
||||
#include "operation_private.h"
|
||||
#include "vsi_nn_pub.h"
|
||||
|
||||
namespace tim {
|
||||
namespace vx {
|
||||
namespace ops {
|
||||
|
||||
Reverse::Reverse(Graph* graph, int32_t* axis, uint32_t axis_num)
|
||||
: Operation(graph, VSI_NN_OP_REVERSE), axis_(axis), axis_num_(axis_num) {
|
||||
this->impl()->node()->nn_param.reverse.axis = axis_;
|
||||
this->impl()->node()->nn_param.reverse.axis_num = axis_num_;
|
||||
}
|
||||
} // namespace ops
|
||||
} // namespace vx
|
||||
} // namespace tim
|
||||
|
|
@ -28,7 +28,6 @@
|
|||
|
||||
namespace tim {
|
||||
namespace vx {
|
||||
|
||||
namespace ops {
|
||||
|
||||
SpaceToDepth::SpaceToDepth(Graph* graph, std::vector<int> block_size)
|
||||
|
|
|
|||
Loading…
Reference in New Issue