add the Stack op

This commit is contained in:
zhengzhouheng 2021-04-07 14:09:39 +08:00 committed by Kainan Cha
parent 165b3fcf8f
commit dc67e9ac63
3 changed files with 85 additions and 1 deletions

44
include/tim/vx/ops/stack.h Executable file
View File

@ -0,0 +1,44 @@
/****************************************************************************
*
* 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_STACK_H_
#define TIM_VX_OPS_STACK_H_
#include "tim/vx/operation.h"
namespace tim {
namespace vx {
namespace ops {
class Stack : public Operation {
public:
Stack(Graph* graph, uint32_t axis, int input_cnt);
protected:
uint32_t axis_;
};
} // namespace ops
} // namespace vx
} // namespace tim
#endif /* TIM_VX_OPS_STACK_H_ */

View File

@ -83,7 +83,7 @@ Select|SELECT|Mapped
||LSTMUNIT_OVXLIB|Unmapped ||LSTMUNIT_OVXLIB|Unmapped
||TENSOR_ADD_MEAN_STDDEV_NORM|Unmapped ||TENSOR_ADD_MEAN_STDDEV_NORM|Unmapped
Relu1|RELU1|Mapped Relu1|RELU1|Mapped
||STACK|Unmapped Stack|STACK|Mapped
||FLOOR|Unmapped ||FLOOR|Unmapped
Square|SQUARE|Mapped Square|SQUARE|Mapped
Neg|NEG|Mapped Neg|NEG|Mapped

40
src/tim/vx/ops/stack.cc Executable file
View File

@ -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/stack.h"
#include "operation_private.h"
#include "vsi_nn_pub.h"
namespace tim {
namespace vx {
namespace ops {
Stack::Stack(Graph* graph, uint32_t axis, int input_cnt)
: Operation(graph, VSI_NN_OP_STACK, input_cnt, 1), axis_(axis) {
this->impl()->node()->nn_param.stack.axis = axis_;
}
} // namespace ops
} // namespace vx
} // namespace tim