Skip to content
Snippets Groups Projects

Removed padding from conv and pool and added Pad operator

Merged Olivier BICHLER requested to merge padding into main

I think padding should be removed from Conv and Pool operators. From N2D2 experience, padding adds a lot of complexity to the operator implementations. Third party conv and pool implementations do not always support padding or all types of padding (e.g. CuDNN only supports symmetric padding).

We could have a PaddedConv meta-operator to take advantage of implementations that support padding inside conv. It could be a good first use case for meta-operator, that I will try to include in this MR.

  • Remove padding from operators
  • Add Pad implementation
    • Add Constant mode implementation
    • Handle other modes
  • Add PaddedConv and PaddedPooling meta-operators
    • Add meta-operator prototype
    • Requires ordered inputs for GraphView @pineapple => for now, specify ordered inputs/outputs in the meta-op
    • Requires generateScheduling() to be callable iteratively @cmoineau => should be OK
  • Update previously padded layers unit-tests

If we agree on having a separate Pad operator, I still have some questions :

  • Should it be one or several operators? For example, should we have a specific ZeroPad operator for 0-padding only? Or a little more general ConstantPadding for padding with a given value?

    :arrow_right: Use a single Operator.

  • What should be the parameters of this operators? Like constant, replicate, reflective... to handle different type of classical padding in computer vision.

    :arrow_right: Current list is Constant, Replicate, Reflect, Wrap, which are pretty standard.

Edited by Olivier BICHLER

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Maxence Naud changed the description

    changed the description

  • Maxence Naud changed milestone to %v0.1.0

    changed milestone to %v0.1.0

  • Maxence Naud added 1 deleted label

    added 1 deleted label

  • Since ZeroPad is basically Pad({dims}, "constant", 0.0), default values could already be set to provide a ZeroPad function. So I think this function is not needed.

  • Olivier BICHLER changed the description

    changed the description

  • Olivier BICHLER added 1 commit

    added 1 commit

    • 9b3c6ec2 - Added first MetaOperator prototype

    Compare with previous version

  • Olivier BICHLER changed the description

    changed the description

  • mentioned in merge request aidge_backend_cpu!7 (merged)

  • Olivier BICHLER added 4 commits

    added 4 commits

    • 48ce14d2 - Changed GraphView inputs() and dataInputs() behavior
    • 3e041bf9 - Fixed Pad op
    • a35bdf17 - If forward() calls generateScheduling(), then mStaticSchedule should be cleared
    • d376906b - Make MetaOperator work for PaddedConv

    Compare with previous version

  • Olivier BICHLER changed the description

    changed the description

  • Olivier BICHLER added 127 commits

    added 127 commits

    Compare with previous version

  • Olivier BICHLER changed the description

    changed the description

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading