Skip to content

Draft: [Feat] Add resize interpolation mode safeguard

Axel Farrugia requested to merge feat_add_resize_interpolation_mode_safeguard into dev

Context

While registering an operator as supported by an ExportLib, we may need to specify limitations over its attributes.
This is the case for the Resize node which is supported in the export CPP but only with one specific interpolation_mode.

Then registering the Resize should look like this :

@ExportLibCpp.register("Resize", 
    aidge_core.ImplSpec(
        [ # Input specifications
            aidge_core.IOSpec(aidge_core.dtype.any, aidge_core.dformat.nhwc),
            aidge_core.IOSpec(aidge_core.dtype.any, aidge_core.dformat.any),
            aidge_core.IOSpec(aidge_core.dtype.any, aidge_core.dformat.any)
        ],
        [ # Output specifications
            aidge_core.IOSpec(aidge_core.dtype.any, aidge_core.dformat.nhwc)
        ],
        # Attribute specification
        aidge_core.DynamicAttributes(interpolation_mode=aidge_core.Interpolation.Mode.CUBIC)
    ))

In order for this code to work properly, the DynamicAttributes(**kwargs) constructor should be binded, which is the object of this MR.

Changes

Feat

  • Add safeguard so that the resize is exported only if it has the correct interpolation_mode

Merge request reports

Loading