File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ class DynamicShapeInferer : public ir::OperationVisitor
5252 void visit (const ir::operation::Comparison &op) override ;
5353 void visit (const ir::operation::Concat &op) override ;
5454 void visit (const ir::operation::Conv2D &op) override ;
55+ void visit (const ir::operation::DepthwiseConv2D &op) override ;
5556 void visit (const ir::operation::ElementwiseActivation &op) override ;
5657 void visit (const ir::operation::ElementwiseBinary &op) override ;
5758 void visit (const ir::operation::ElementwiseUnary &op) override ;
Original file line number Diff line number Diff line change @@ -337,6 +337,31 @@ void DynamicShapeInferer::visit(const ir::operation::Conv2D &op)
337337 assert (output->buffer () != nullptr );
338338}
339339
340+ void DynamicShapeInferer::visit (const ir::operation::DepthwiseConv2D &op)
341+ {
342+ // check if input is not dynamic
343+ auto input_ind = op.getInputs ().at (ir::operation::DepthwiseConv2D::INPUT);
344+ auto input = _tensor_registry->getITensor (input_ind);
345+
346+ auto ker_ind = op.getInputs ().at (ir::operation::DepthwiseConv2D::KERNEL);
347+ auto ker = _tensor_registry->getITensor (ker_ind);
348+
349+ if ((!input->is_dynamic ()) && (!ker->is_dynamic ()))
350+ return ;
351+
352+ ir::Shape input_shape = input->getShape ();
353+ ir::Shape ker_shape = ker->getShape ();
354+
355+ auto output_ind = op.getOutputs ().at (0 );
356+ auto output = _tensor_registry->getITensor (output_ind);
357+
358+ ir::Shape output_shape =
359+ shape_inference::inferDepthwiseConv2DShape (input_shape, ker_shape, op.param ());
360+
361+ output->applyShape (output_shape);
362+ assert (output->buffer () != nullptr );
363+ }
364+
340365void DynamicShapeInferer::visit (const ir::operation::ElementwiseActivation &op)
341366{
342367 handleSimpleUnaryOp (op, op.getInputs ().at (ir::operation::ElementwiseActivation::INPUT));
You can’t perform that action at this time.
0 commit comments