#
# SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
---
name: CropAndResizeDynamic
versions:
  "1": # Legacy Ver 1
    interface: "IPluginV2DynamicExt"
    inputs:
      - feature_maps
      - rois
    outputs:
      - pfmap
    input_dims:
      input1: 4
      input2: 4
    input_dim_constraints:
      - "feature_maps_0 == rois_0"
      - "rois_2 == 4"
      - "rois_3 == 1"
    output_dims:
      pfmap: "feature_maps_0, rois_1, feature_maps_1, crop_width_0, crop_height_0"
    attributes:
      - crop_height
      - crop_width
    attribute_types:
      crop_height: int32
      crop_width: int32
    attribute_length:
      crop_height: 1
      crop_width: 1
    attribute_options:
      crop_height:
        min: "0"
        max: "=pinf"
      crop_width:
        min: "0"
        max: "=pinf"
    attributes_required:
      - crop_height
      - crop_width
    golden_io_path: "plugin/CropAndResizeDynamic_PluginGoldenIO.json"
    abs_tol: 1e-6
    rel_tol: 1e-6
    fp16_atol: 1e-3
    fp16_rtol: 1e-3
    configs:
      config_base:
        input_types:
          feature_maps: "float32"
          rois: "float32"
        attribute_options:
          crop_height:
            value: 7
          crop_width:
            value: 7
      config_larger:
        input_types:
          feature_maps: "float32"
          rois: "float32"
        attribute_options:
          crop_height:
            value: 14
          crop_width:
            value: 14
  "2": # New Ver 2 (using IPluginV3 interface)
    interface: "IPluginV3"
    inputs:
      - feature_maps
      - rois
    outputs:
      - pfmap
    input_dims:
      input1: 4
      input2: 4
    input_dim_constraints:
      - "feature_maps_0 == rois_0"
      - "rois_2 == 4"
      - "rois_3 == 1"
    output_dims:
      pfmap: "feature_maps_0, rois_1, feature_maps_1, crop_width_0, crop_height_0"
    attributes:
      - crop_height
      - crop_width
    attribute_types:
      crop_height: int32
      crop_width: int32
    attribute_length:
      crop_height: 1
      crop_width: 1
    attribute_options:
      crop_height:
        min: "0"
        max: "=pinf"
      crop_width:
        min: "0"
        max: "=pinf"
    attributes_required:
      - crop_height
      - crop_width
    golden_io_path: "plugin/CropAndResizeDynamic_PluginGoldenIO.json"
    abs_tol: 1e-6
    rel_tol: 1e-6
    fp16_atol: 1e-3
    fp16_rtol: 1e-3
    configs:
      config_base:
        input_types:
          feature_maps: "float32"
          rois: "float32"
        attribute_options:
          crop_height:
            value: 7
          crop_width:
            value: 7
      config_larger:
        input_types:
          feature_maps: "float32"
          rois: "float32"
        attribute_options:
          crop_height:
            value: 14
          crop_width:
            value: 14
...
