ONE - On-device Neural Engine
Loading...
Searching...
No Matches
mir::ops::ConcatOp Class Reference

Description of tensor concatenation operation. More...

#include <ConcatOp.h>

Collaboration diagram for mir::ops::ConcatOp:

Public Member Functions

 ConcatOp (const std::vector< Output * > &args, int32_t axis)
 
OperationcopyWithInputs (const std::vector< Output * > &inputs) override
 
int32_t getAxis () const
 
- Public Member Functions inherited from mir::Operation
virtual ~Operation ()=default
 
Type getType () const
 
std::size_t getId () const
 
void setId (std::size_t id)
 
std::size_t getNumInputs () const
 
std::size_t getNumOutputs () const
 
std::deque< Output * > & getInputs ()
 
const std::deque< Output * > & getInputs () const
 
std::deque< Output > & getOutputs ()
 
const std::deque< Output > & getOutputs () const
 
OutputgetInput (std::size_t index)
 
const OutputgetInput (std::size_t index) const
 
OutputgetOutput (std::size_t index)
 
const OutputgetOutput (std::size_t index) const
 
const ShapegetInputShape (std::size_t index) const
 
const ShapegetOutputShape (std::size_t index) const
 
void accept (IVisitor *v)
 

Additional Inherited Members

- Public Types inherited from mir::Operation
enum class  Type { HANDLE_OP }
 
- Protected Member Functions inherited from mir::Operation
 Operation (Type type, const std::vector< Output * > &inputs, std::size_t num_outputs=1)
 
void setOutputType (std::size_t index, const TensorType &type)
 

Detailed Description

Description of tensor concatenation operation.

Definition at line 30 of file ConcatOp.h.

Constructor & Destructor Documentation

◆ ConcatOp()

mir::ops::ConcatOp::ConcatOp ( const std::vector< Output * > &  args,
int32_t  axis 
)
inline

Definition at line 33 of file ConcatOp.h.

34 : Operation(Type::concat, args), _axis(axis)
35 {
36 inferOutputTypes();
37 }

Member Function Documentation

◆ copyWithInputs()

Operation * mir::ops::ConcatOp::copyWithInputs ( const std::vector< Output * > &  inputs)
inlineoverridevirtual

Implements mir::Operation.

Definition at line 39 of file ConcatOp.h.

40 {
41 return new ConcatOp(inputs, _axis);
42 };
ConcatOp(const std::vector< Output * > &args, int32_t axis)
Definition ConcatOp.h:33

◆ getAxis()

int32_t mir::ops::ConcatOp::getAxis ( ) const
inline

Definition at line 44 of file ConcatOp.h.

45 {
46 if (_axis < 0)
47 {
48 // Negative axis is used to index starting from the last element of the shape
49 // -1 means last element, -2 means second from end, like in python
50 int32_t res = _axis + getInputShape(0).rank();
51 assert(res >= 0);
52 return res;
53 }
54 return _axis;
55 }
const Shape & getInputShape(std::size_t index) const
Definition Operation.h:161
int32_t rank() const
Definition Shape.h:43

References mir::Operation::getInputShape(), and mir::Shape::rank().

Referenced by mir_interpreter::MIRInterpreter::visit(), mir2loco::Transformer::visit(), nnc::AclCppOpGenerator::visit(), nnc::Serializer::visit(), and mir::DotNodeBuilder::visit().


The documentation for this class was generated from the following files: