|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327 |
- /**
- * Copyright 2019-2020 Huawei Technologies Co., Ltd
- *
- * 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.
- */
-
- #ifndef GE_OP_MAGE_OPS_H_
- #define GE_OP_MAGE_OPS_H_
-
- #include "graph/operator_reg.h"
-
- namespace ge {
-
- /**
- *@brief Adjust the hue of one or more images.
-
- *@par Inputs:
- *Input images is a tensor of at least 3 dimensions. The last dimension is \n
- interpretted as channels, and must be three. Inputs include: \n
- *@li images:A Tensor of type float. Images to adjust. At least 3-D.
- *@li delta:A Tensor of type float. A float delta to add to the hue.
-
- *@par Outputs:
- *y:A Tensor of type float.
-
- *@attention Constraints: \n
- *Input images is a tensor of at least 3 dimensions. The last dimension is \n
- interpretted as channels, and must be three.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow AdjustHue operator.
- */
-
- REG_OP(AdjustHue)
- .INPUT(images, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(delta, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OP_END_FACTORY_REG(AdjustHue)
-
- /**
- *@brief Adjust the saturation of one or more images.
-
- *@par Inputs:
- *Input images is a tensor of at least 3 dimensions. The last dimension is \n
- interpretted as channels, and must be three. Inputs include: \n
- *@li images:A Tensor of type float. Images to adjust. At least 3-D.
- *@li scale:A Tensor of type float. A float scale to add to the saturation.
-
- *@par Outputs:
- *y:A Tensor of type float.
-
- *@attention Constraints: \n
- *Input images is a tensor of at least 3 dimensions. The last dimension is \n
- interpretted as channels, and must be three.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow AdjustSaturation operator.
- */
-
- REG_OP(AdjustSaturation)
- .INPUT(images, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(scale, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OP_END_FACTORY_REG(AdjustSaturation)
-
- /**
- *@brief Adjust the contrast of one or more images.
-
- *@par Inputs:
- *Input images is a tensor of at least 3 dimensions. The last 3 dimensions are \n
- interpreted as '[height, width, channels]'. Inputs include: \n
- *@li images:A Tensor of type float. Images to adjust. At least 3-D.
- *@li scale:A Tensor of type float. A float multiplier for adjusting contrast.
-
- *@par Outputs:
- *y:A Tensor of type float.
-
- *@attention Constraints: \n
- *Input images is a tensor of at least 3 dimensions. The last dimension is \n
- interpretted as channels, and must be three.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow AdjustContrast operator.
- */
-
- REG_OP(AdjustContrast)
- .INPUT(images, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(contrast_factor, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OP_END_FACTORY_REG(AdjustContrast)
-
- /**
- *@brief Extracts crops from the input image tensor and resizes them. Extracts \n
- crops from the input image tensor and resizes them using bilinear sampling or \n
- nearest neighbor sampling to a common output size specified by crop_size.
-
- *@par Inputs:
- *Input images must be a 4-D tensor. Inputs include: \n
- *@li images:A Tensor. Must be one of the following types:uint8, uint16, int8, \n
- int16, int32, int64, float16, float, double. A 4-D tensor of shape \n
- [batch, image_height, image_width, depth].
- *@li boxes: A Tensor of type float. A 2-D tensor of shape [num_boxes, 4].
- *@li box_index: A Tensor of type int32. A 1-D tensor of shape [num_boxes] with \n
- int32 values in [0, batch).
- *@li crop_size: A Tensor of type int32. A 1-D tensor of 2 elements, crop_size \n
- = [crop_height, crop_width]. All cropped image patches are resized to this size.
-
- *@par Attributes:
- *@li extrapolation_value: An optional float. Defaults to 0. Value used for \n
- extrapolation, when applicable.
- *@li method: An optional string from: '"bilinear", "nearest"'. Defaults to \n
- "bilinear". Currently two sampling methods are supported: Bilinear and \n
- NearestNeighbor.
-
- *@par Outputs:
- *y:A Tensor of type float.
-
- *@attention Constraints: \n
- *Input images must be a 4-D tensor.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow CropAndResize operator.
- */
-
- REG_OP(CropAndResize)
- .INPUT(x, TensorType({DT_UINT8, DT_UINT16, DT_INT8, \
- DT_INT16, DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(boxes, TensorType({DT_FLOAT}))
- .INPUT(box_index, TensorType({DT_INT32}))
- .INPUT(crop_size, TensorType({DT_INT32}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(extrapolation_value, Float, 0)
- .ATTR(method, String, "bilinear")
- .OP_END_FACTORY_REG(CropAndResize)
-
- /**
- *@brief Extracts crops from the input image tensor and resizes them. Extracts \n
- crops from the input image tensor and resizes them using bilinear sampling or \n
- nearest neighbor sampling to a common output size specified by crop_size.
-
- *@par Inputs:
- *Input images must be a 5HD tensor. Inputs include: \n
- *@li images:A Tensor. Must be one of the following types:float. A 5HD tensor of shape \n
- [batch, C1, image_height, image_width, C0].
- *@li boxes: A Tensor of type float. A 2-D tensor of shape [num_boxes, 4].
- *@li box_index: A Tensor of type int32. A 1-D tensor of shape [num_boxes] with \n
- int32 values in [0, batch - 1).
-
- *@par Attributes:
- *@li crop_size: list int. [crop_height, crop_width]. All cropped image patches are resized to this size.
- *@li extrapolation_value: An optional float. Defaults to 0. Value used for \n
- extrapolation, when applicable.
- *@li method: An optional string from: '"bilinear"'. Defaults to \n
- "bilinear".
-
- *@par Outputs:
- *y:A Tensor of type float.
-
- *@attention Constraints: \n
- *Input images must be a 5HD tensor.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow CropAndResize operator.
- */
- REG_OP(CropAndResizeD)
- .INPUT(x, TensorType({DT_FLOAT}))
- .INPUT(boxes, TensorType({DT_FLOAT}))
- .INPUT(box_index, TensorType({DT_INT32}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .REQUIRED_ATTR(crop_size, ListInt)
- .ATTR(extrapolation_value, Float, 0)
- .ATTR(method, String, "bilinear")
- .OP_END_FACTORY_REG(CropAndResizeD)
-
- /**
- *@brief Computes the gradient of the crop_and_resize op wrt the input \n
- boxes tensor.
-
- *@par Inputs:
- *Input images and grads must be a 4-D tensor. Inputs include: \n
- *@li grads: A 4-D tensor of shape [num_boxes, crop_height, crop_width, depth].
- *@li images: A 4-D tensor of shape [batch, image_height, image_width, depth]. \n
- Both image_height and image_width need to be positive.
- *@li boxes: A 2-D tensor of shape [num_boxes, 4]. The i-th row of the tensor \n
- specifies the coordinates of a box in the box_ind[i] image and is specified in \n
- normalized coordinates [y1, x1, y2, x2].
- *@li box_index: A 1-D tensor of shape [num_boxes] with int32 values in \n
- [0, batch). The value of box_ind[i] specifies the image that the i-th box \n
- refers to.
-
- *@par Attributes:
- method: A string specifying the interpolation method. Only 'bilinear' is \n
- supported for now.
-
- *@par Outputs:
- *y:A 2-D tensor of shape [num_boxes, 4].
-
- *@attention Constraints: \n
- *Input images and grads must be a 4-D tensor.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow CropAndResizeGradBoxes operator.
- */
-
- REG_OP(CropAndResizeGradBoxes)
- .INPUT(grads, TensorType({DT_FLOAT}))
- .INPUT(images, TensorType({DT_UINT8, DT_UINT16, DT_INT8, DT_INT16, \
- DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(boxes, TensorType({DT_FLOAT}))
- .INPUT(box_index, TensorType({DT_INT32}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(method, String, "bilinear")
- .OP_END_FACTORY_REG(CropAndResizeGradBoxes)
-
- /**
- *@brief Computes the gradient of the crop_and_resize op wrt the input \n
- images tensor.
-
- *@par Inputs:
- *Input grads must be a 4-D tensor. Inputs include: \n
- *@li grads: A 4-D tensor of shape [num_boxes, crop_height, crop_width, depth].
- *@li boxes: A 2-D tensor of shape [num_boxes, 4]. The i-th row of the tensor \n
- specifies the coordinates of a box in the box_ind[i] image and is specified \n
- in normalized coordinates [y1, x1, y2, x2].
- *@li box_index: A 1-D tensor of shape [num_boxes] with int32 values in \n
- [0, batch). The value of box_ind[i] specifies the image that the i-th box \n
- refers to.
- *@li image_size: A 1-D tensor with value [batch, image_height, image_width, \n
- depth] containing the original image size. Both image_height and image_width \n
- need to be positive.
-
- *@par Attributes:
- method: A string specifying the interpolation method. Only 'bilinear' is \n
- supported for now.
-
- *@par Outputs:
- *y:A 4-D tensor of shape [batch, image_height, image_width, depth].
-
- *@attention Constraints: \n
- *Input grads must be a 4-D tensor.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow CropAndResizeGradImage operator.
- */
-
- REG_OP(CropAndResizeGradImage)
- .INPUT(grads, TensorType({DT_FLOAT}))
- .INPUT(boxes, TensorType({DT_FLOAT}))
- .INPUT(box_index, TensorType({DT_INT32}))
- .INPUT(image_size, TensorType({DT_INT32}))
- .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .ATTR(method, String, "bilinear")
- .REQUIRED_ATTR(T, Type)
- .OP_END_FACTORY_REG(CropAndResizeGradImage)
-
- /**
- *@brief Extracts a glimpse from the input tensor.
-
- *@par Inputs:
- *Input x must be a 4-D tensor. Inputs include: \n
- *@li x: A 4-D float tensor of shape [batch_size, height, width, channels].
- *@li size: A 1-D tensor of 2 elements containing the size of the glimpses to \n
- extract. The glimpse height must be specified first, following by the glimpse \n
- width.
- *@li offsets: A 2-D integer tensor of shape [batch_size, 2] containing the y, \n
- x locations of the center of each window.
-
- *@par Attributes:
- *@li centered: indicates if the offset coordinates are centered relative to \n
- the image, in which case the (0, 0) offset is relative to the center of the \n
- input images. If false, the (0,0) offset corresponds to the upper left corner \n
- of the input images.
- *@li normalized: indicates if the offset coordinates are normalized.
- *@li uniform_noise: indicates if the noise should be generated using a \n
- uniform distribution or a Gaussian distribution.
- *@li noise: indicates if the noise should uniform, gaussian, or zero. \n
- The default is uniform which means the the noise type will be decided by \n
- uniform_noise.
-
- *@par Outputs:
- *y:A tensor representing the glimpses [batch_size, glimpse_height, \n
- glimpse_width, channels].
-
- *@attention Constraints: \n
- *Input x must be a 4-D tensor.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow CropAndResizeGradImage operator.
- */
-
- REG_OP(ExtractGlimpse)
- .INPUT(x, TensorType({DT_FLOAT}))
- .INPUT(size, TensorType({DT_INT32}))
- .INPUT(offsets, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(centered, Bool, true)
- .ATTR(normalized, Bool, true)
- .ATTR(uniform_noise, Bool, true)
- .ATTR(noise, String, "uniform")
- .OP_END_FACTORY_REG(ExtractGlimpse)
-
- /**
- *@brief Convert one or more images from HSV to RGB.
-
- *@par Inputs:
- *Last dimension of input x must be size 3. Inputs include: \n
- *images: 1-D or higher rank. HSV data to convert. Last dimension must be size 3.
-
- *@par Outputs:
- *y:images converted to RGB.
-
- *@attention Constraints: \n
- *Last dimension of input x must be size 3.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow HSVToRGB operator.
- */
-
- REG_OP(HSVToRGB)
- .INPUT(images, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE}))
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE}))
- .OP_END_FACTORY_REG(HSVToRGB)
-
- /**
- *@brief Resize quantized images to size using quantized bilinear interpolation.
-
- *@par Inputs:
- *Input images must be a 4-D tensor. Inputs include: \n
- *@li images: 4-D with shape [batch, height, width, channels].
- *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width. The new \n
- size for the images.
- *@li min: A Tensor of type float.
- *@li max: A Tensor of type float.
-
- *@par Attributes:
- *@li align_corners: An optional bool. Defaults to False. If true, the centers \n
- of the 4 corner pixels of the input and output tensors are aligned, preserving \n
- the values at the corner pixels. Defaults to false.
- *@li half_pixel_centers: indicates if the offset coordinates are normalized.
-
- *@par Outputs:
- *@li resized_images: 4-D with shape [batch, new_height, new_width, channels].
- *@li y_min: A Tensor of type float.
- *@li y_max: A Tensor of type float.
-
- *@attention Constraints: \n
- *Input images and output images must be quantized types.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow QuantizedResizeBilinear operator.
- */
-
- REG_OP(QuantizedResizeBilinear)
- .INPUT(images, TensorType({DT_QUINT8,DT_QINT32,DT_FLOAT}))
- .INPUT(size, TensorType({ DT_INT32 }))
- .INPUT(min, TensorType({ DT_FLOAT }))
- .INPUT(max, TensorType({ DT_FLOAT }))
- .OUTPUT(resized_images, TensorType({DT_QUINT8,DT_QINT32,DT_FLOAT }))
- .OUTPUT(y_min, TensorType({ DT_FLOAT }))
- .OUTPUT(y_max, TensorType({ DT_FLOAT }))
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(QuantizedResizeBilinear)
-
- /**
- *@brief Resize images to size using area interpolation.
-
- *@par Inputs:
- *Input images must be a 4-D tensor. Inputs include: \n
- *@li images: 4-D with shape [batch, height, width, channels].
- *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width. \n
- The new size for the images.
-
- *@par Attributes:
- *align_corners: If true, the centers of the 4 corner pixels of the input and \n
- output tensors are aligned, preserving the values at the corner pixels. \n
- Defaults to false.
-
- *@par Outputs:
- *y: 4-D with shape [batch, new_height, new_width, channels].
-
- *@attention Constraints: \n
- *Input images can be of different types but output images are always float.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow ResizeArea operator.
- */
-
- REG_OP(ResizeArea)
- .INPUT(images, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, \
- DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(size, TensorType({DT_INT32}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(align_corners, Bool, false)
- .OP_END_FACTORY_REG(ResizeArea)
-
- /**
- *@brief Computes the gradient of bicubic interpolation.
-
- *@par Inputs:
- *Input grads must be a 4-D tensor. Inputs include: \n
- *@li grads: A Tensor of type float. 4-D with shape [batch, height, width, \n
- channels].
- *@li original_image: A Tensor. Must be one of the following types: float, \n
- double. 4-D with shape [batch, orig_height, orig_width, channels], The image \n
- tensor that was resized.
-
- *@par Attributes:
- *@li align_corners: An optional bool. Defaults to False. If true, the centers \n
- of the 4 corner pixels of the input and grad tensors are aligned. Defaults to \n
- false.
- *@li half_pixel_centers: An optional bool. Defaults to False.
-
- *@par Outputs:
- *y: A Tensor. Has the same type as original_image.
-
- *@attention Constraints: \n
- *Input images can be of different types but output images are always float.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow ResizeBicubicGrad operator.
- */
-
- REG_OP(ResizeBicubicGrad)
- .INPUT(grads, TensorType({DT_FLOAT}))
- .INPUT(original_image, TensorType({DT_FLOAT, DT_DOUBLE}))
- .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE}))
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(ResizeBicubicGrad)
-
- /**
- *@brief Resize images to size using bicubic interpolation.
-
- *@par Inputs:
- *Input images must be a 4-D tensor. Inputs include: \n
- *@li images: 4-D with shape [batch, height, width, channels].
- *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width. The new \n
- size for the images.
-
- *@par Attributes:
- *@li align_corners: If true, the centers of the 4 corner pixels of the input \n
- and output tensors are aligned, preserving the values at the corner pixels. \n
- Defaults to false.
- *@li half_pixel_centers: An optional bool. Defaults to False.
-
- *@par Outputs:
- *y: 4-D with shape [batch, new_height, new_width, channels].
-
- *@attention Constraints: \n
- *Input images can be of different types but output images are always float.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow ResizeBicubic operator.
- */
-
- REG_OP(ResizeBicubic)
- .INPUT(images, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, \
- DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(size, TensorType({DT_INT32}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(ResizeBicubic)
-
- /**
- *@brief Computes the gradient of nearest neighbor interpolation.
-
- *@par Inputs:
- *Input grads must be a 4-D tensor. Inputs include: \n
- *@li grads: A Tensor. Must be one of the following types: uint8, int8, int32, \n
- float16, float, double. 4-D with shape [batch, height, width, channels].
- *@li size: A 1-D int32 Tensor of 2 elements: orig_height, orig_width. \n
- The original input size.
-
- *@par Attributes:
- *@li align_corners: An optional bool. Defaults to False. If true, the centers \n
- of the 4 corner pixels of the input and grad tensors are aligned. Defaults to \n
- false.
- *@li half_pixel_centers: An optional bool. Defaults to False.
-
- *@par Outputs:
- *y: A Tensor. Has the same type as grads.
-
- *@attention Constraints: \n
- *Input grads must be a 4-D tensor.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow ResizeNearestNeighborV2Grad operator.
- */
-
- REG_OP(ResizeNearestNeighborV2Grad)
- .INPUT(grads, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32,
- DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(size, TensorType({DT_INT32}))
- .OUTPUT(y, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32,
- DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(ResizeNearestNeighborV2Grad)
-
- /**
- *@brief Computes the gradient of nearest neighbor interpolation.
-
- *@par Inputs:
- *Input grads must be a 4-D tensor. Inputs include: \n
- *grads: A Tensor. 4-D with shape [batch, height, width, channels].
-
-
- *@par Attributes:
- *@li align_corners: An optional bool. Defaults to False. If true, the centers \n
- of the 4 corner pixels of the input and grad tensors are aligned. Defaults to \n
- false.
- *@li size: An list type. Specify the images size.
-
- *@par Outputs:
- *y: A Tensor. Has the same type as grads.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow ResizeNearestNeighborV2GradD operator.
- */
-
- REG_OP(ResizeNearestNeighborV2GradD)
- .INPUT(grads, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .REQUIRED_ATTR(size, ListInt)
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(ResizeNearestNeighborV2GradD)
-
- /**
- *@brief Computes the gradient of bilinear interpolation.
-
- *@par Inputs:
- *Input grads must be a 4-D tensor. Inputs include: \n
- *@li grads: A Tensor of type float32. 4-D with shape [batch, height, width, \n
- channels].
- *@li original_image: A Tensor. 4-D with shape [batch, orig_height, orig_width, \n
- channels], The image tensor that was resized.
-
- *@par Attributes:
- *align_corners: An optional bool. Defaults to False. If true, the centers of \n
- the 4 corner pixels of the input and grad tensors are aligned. Defaults to \n
- false.
-
- *@par Outputs:
- *y: A Tensor. Has the same type as original_image.
-
- *@attention Constraints: \n
- *Input grads must be a 4-D tensor.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow ResizeBilinearV2Grad operator.
- */
-
- REG_OP(ResizeBilinearV2Grad)
- .INPUT(grads, TensorType({DT_FLOAT}))
- .INPUT(original_image, TensorType::FloatingDataType())
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(ResizeBilinearV2Grad)
-
- /**
- *@brief Resize images to size using bilinear interpolation.
-
- *@par Inputs:
- *Input images must be a 4-D tensor. Inputs include: \n
- *@li x: 4-D with shape [batch, height, width, channels].
- *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width. The new \n
- size for the images.
-
- *@par Attributes:
- *align_corners: If true, the centers of the 4 corner pixels of the input and \n
- output tensors are aligned, preserving the values at the corner pixels. \n
- Defaults to false.
-
- *@par Outputs:
- *y: 4-D with shape [batch, new_height, new_width, channels].
-
- *@attention Constraints: \n
- *Input images can be of different types but output images are always float.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow ResizeBilinearV2 operator.
- */
-
- REG_OP(ResizeBilinearV2)
- .INPUT(x, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16,
- DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(size, TensorType({DT_INT32}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(ResizeBilinearV2)
-
- /**
- *@brief Converts one or more images from RGB to HSV.
-
- *@par Inputs:
- *Last dimension of input images must be size 3. Inputs include: \n
- *images: A Tensor. Must be one of the following types: float, double. 1-D or \n
- higher rank. RGB data to convert. Last dimension must be size 3.
-
- *@par Outputs:
- *y: A Tensor. Has the same type as images.
-
- *@attention Constraints: \n
- *Outputs a tensor of the same shape as the images tensor, containing the HSV \n
- value of the pixels. The output is only well defined if the value in images \n
- are in [0,1].
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow RGBToHSV operator.
- */
-
- REG_OP(RGBToHSV)
- .INPUT(images, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE }))
- .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE }))
- .OP_END_FACTORY_REG(RGBToHSV)
-
- /**
- *@brief Generate a single randomly distorted bounding box for an image.
-
- *@par Inputs:
- *Input images must be a 4-D tensor. Inputs include: \n
- *@li image_size: 1-D, containing [height, width, channels].
- *@li bounding_boxes: 3-D with shape [batch, N, 4] describing the N bounding \n
- boxes associated with the image.
- *@li min_object_covered: The cropped area of the image must contain at least \n
- this fraction of any bounding box supplied. The value of this parameter should \n
- be non-negative. In the case of 0, the cropped area does not need to overlap \n
- any of the bounding boxes supplied.
-
- *@par Attributes:
- *@li seed: If either seed or seed2 are set to non-zero, the random number \n
- generator is seeded by the given seed. Otherwise, it is seeded by a random seed.
- *@li seed2: A second seed to avoid seed collision.
- *@li aspect_ratio_range: The cropped area of the image must have an aspect \n
- ratio = width / height within this range.
- *@li max_attempts: Number of attempts at generating a cropped region of the \n
- image of the specified constraints. After max_attempts failures, return the \n
- entire image.
- *@li use_image_if_no_bounding_boxes: Controls behavior if no bounding boxes \n
- supplied. If true, assume an implicit bounding box covering the whole input. \n
- If false, raise an error.
-
- *@par Outputs:
- *@li begin: 1-D, containing [offset_height, offset_width, 0].
- *@li size: 1-D, containing [target_height, target_width, -1].
- *@li bboxes: 3-D with shape [1, 1, 4] containing the distorted bounding box.
-
- *@attention Constraints: \n
- *Input images can be of different types but output images are always float.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow SampleDistortedBoundingBoxExt2 operator.
- */
-
- REG_OP(SampleDistortedBoundingBoxExt2)
- .INPUT(image_size, TensorType({ DT_UINT8, DT_INT8, DT_INT16, \
- DT_INT32, DT_INT64 }))
- .INPUT(bounding_boxes, TensorType({ DT_FLOAT }))
- .INPUT(min_object_covered, TensorType({ DT_FLOAT }))
- .OUTPUT(begin, TensorType({ DT_UINT8, DT_INT8, DT_INT16, \
- DT_INT32, DT_INT64 }))
- .OUTPUT(size, TensorType({ DT_UINT8, DT_INT8, DT_INT16, \
- DT_INT32, DT_INT64 }))
- .OUTPUT(bboxes, TensorType({ DT_FLOAT }))
- .ATTR(seed, Int, 0)
- .ATTR(seed2, Int, 0)
- .ATTR(aspect_ratio_range, ListFloat, { 0.75f, 1.33f })
- .ATTR(area_range, ListFloat, { 0.05f, 1.0f })
- .ATTR(max_attempts, Int, 100)
- .ATTR(use_image_if_no_bounding_boxes, Bool, false)
- .OP_END_FACTORY_REG(SampleDistortedBoundingBoxExt2)
-
- /**
- *@brief Resize images to size using nearest neighbor interpolation.
-
- *@par Inputs:
- *Input x must be a 4-D tensor. Inputs include: \n
- *@li x: 4-D with shape [batch, height, width, channels].
- *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width. \n
- The new size for the images.
-
- *@par Attributes:
- *align_corners: If true, the centers of the 4 corner pixels of the input and \n
- output tensors are aligned, preserving the values at the corner pixels. \n
- Defaults to false.
-
- *@par Outputs:
- *y: 4-D with shape [batch, new_height, new_width, channels].
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow ResizeNearestNeighborV2 operator.
- */
-
- REG_OP(ResizeNearestNeighborV2)
- .INPUT(x, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32,
- DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(size, TensorType({DT_INT32}))
- .OUTPUT(y, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32,
- DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(ResizeNearestNeighborV2)
-
- /**
- *@brief Draw bounding boxes on a batch of images.
-
- *@par Inputs:
- *Input images must be a 4-D tensor. Inputs include: \n
- *@li images: A Tensor. Must be one of the following types: float. 4-D with \n
- shape [batch, height, width, depth]. A batch of images.
- *@li boxes: A Tensor of type float32. 3-D with shape [batch, \n
- num_bounding_boxes, 4] containing bounding boxes.
-
- *@par Outputs:
- *A Tensor. Has the same type as images.
-
- *@attention Constraints: \n
- *Input images must be a 4-D tensor.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow DrawBoundingBoxes operator.
- */
-
- REG_OP(DrawBoundingBoxes)
- .INPUT(images, TensorType({DT_FLOAT}))
- .INPUT(boxes, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .OP_END_FACTORY_REG(DrawBoundingBoxes)
-
- /**
- *@brief Greedily selects a subset of bounding boxes in descending order of \n
- score.
-
- *@par Inputs:
- *Input boxes and scores must be float type. Inputs include: \n
- *@li boxes: A 2-D float tensor of shape [num_boxes, 4].
- *@li scores: A 1-D float tensor of shape [num_boxes] representing a single \n
- score corresponding to each box (each row of boxes).
- *@li max_output_size: A scalar integer tensor representing the maximum number \n
- of boxes to be selected by non max suppression.
-
- *@par Attributes:
- *iou_threshold: A float representing the threshold for deciding whether boxes \n
- overlap too much with respect to IOU.
-
- *@par Outputs:
- *selected_indices: A 1-D integer tensor of shape [M] representing the selected \n
- indices from the boxes tensor, where M <= max_output_size.
-
- *@attention Constraints: \n
- *Input boxes and scores must be float type.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow NonMaxSuppression operator.
- */
-
- REG_OP(NonMaxSuppression)
- .INPUT(boxes, TensorType({DT_FLOAT}))
- .INPUT(scores, TensorType({DT_FLOAT}))
- .INPUT(max_output_size, TensorType({DT_INT32}))
- .OUTPUT(selected_indices, TensorType({DT_INT32}))
- .ATTR(iou_threshold, Float, 0.5f)
- .OP_END_FACTORY_REG(NonMaxSuppression)
-
- /**
- *@brief Greedily selects a subset of bounding boxes in descending order of \n
- score.
-
- *@par Inputs:
- *Input boxes and scores must be float type. Inputs include: \n
- *@li boxes: A 2-D float tensor of shape [num_boxes, 4].
- *@li scores: A 1-D float tensor of shape [num_boxes] representing a single \n
- score corresponding to each box (each row of boxes).
- *@li max_output_size: A scalar integer tensor representing the maximum number \n
- of boxes to be selected by non max suppression.
- *@li iou_threshold: A 0-D float tensor representing the threshold for deciding \n
- whether boxes overlap too much with respect to IOU.
-
- *@par Outputs:
- *selected_indices: A 1-D integer tensor of shape [M] representing the selected \n
- indices from the boxes tensor, where M <= max_output_size.
-
- *@attention Constraints: \n
- *Input boxes and scores must be float type.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow NonMaxSuppressionV2 operator.
- */
-
- REG_OP(NonMaxSuppressionV2)
- .INPUT(boxes, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(scores, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(max_output_size, TensorType({DT_INT32}))
- .INPUT(iou_threshold, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OUTPUT(selected_indices, TensorType({DT_INT32}))
- .OP_END_FACTORY_REG(NonMaxSuppressionV2)
-
- /**
- *@brief Greedily selects a subset of bounding boxes in descending order of \n
- score.
-
- *@par Inputs:
- *Input boxes and scores must be float type. Inputs include: \n
- *@li boxes: A 2-D float tensor of shape [num_boxes, 4].
- *@li scores: A 1-D float tensor of shape [num_boxes] representing a single \n
- score corresponding to each box (each row of boxes).
- *@li max_output_size: A scalar integer tensor representing the maximum number \n
- of boxes to be selected by non max suppression.
- *@li iou_threshold: A 0-D float tensor representing the threshold for deciding \n
- whether boxes overlap too much with respect to IOU.
- *@li score_threshold: A 0-D float tensor representing the threshold for \n
- deciding when to remove boxes based on score.
-
- *@par Outputs:
- *selected_indices: A 1-D integer tensor of shape [M] representing the selected \n
- indices from the boxes tensor, where M <= max_output_size.
-
- *@attention Constraints: \n
- *Input boxes and scores must be float type.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow NonMaxSuppressionV3 operator.
- */
-
- REG_OP(NonMaxSuppressionV3)
- .INPUT(boxes, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(scores, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(max_output_size, TensorType({DT_INT32}))
- .INPUT(iou_threshold, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(score_threshold, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OUTPUT(selected_indices, TensorType({DT_INT32}))
- .OP_END_FACTORY_REG(NonMaxSuppressionV3)
-
- /**
- *@brief Greedily selects a subset of bounding boxes in descending order of \n
- score.
-
- *@par Inputs:
- *Input boxes and scores must be float type. Inputs include: \n
- *@li boxes: A 2-D float tensor of shape [num_boxes, 4].
- *@li scores: A 1-D float tensor of shape [num_boxes] representing a single \n
- score corresponding to each box (each row of boxes).
- *@li max_output_size: A scalar integer tensor representing the maximum number \n
- of boxes to be selected by non max suppression.
- *@li iou_threshold: A 0-D float tensor representing the threshold for deciding \n
- whether boxes overlap too much with respect to IOU.
- *@li score_threshold: A 0-D float tensor representing the threshold for \n
- deciding when to remove boxes based on score.
-
- *@par Attributes:
- *pad_to_max_output_size: If true, the output selected_indices is padded \n
- to be of length max_output_size. Defaults to false.
-
- *@par Outputs:
- *@li selected_indices: A 1-D integer tensor of shape [M] representing the \n
- selected indices from the boxes tensor, where M <= max_output_size.
- *@li valid_outputs: A 0-D integer tensor representing the number of valid \n
- elements in selected_indices, with the valid elements appearing first.
-
- *@attention Constraints: \n
- *Input boxes and scores must be float type.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow NonMaxSuppressionV4 operator.
- */
-
- REG_OP(NonMaxSuppressionV4)
- .INPUT(boxes, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(scores, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(max_output_size, TensorType({DT_INT32}))
- .INPUT(iou_threshold, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(score_threshold, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OUTPUT(selected_indices, TensorType({DT_INT32}))
- .OUTPUT(valid_outputs, TensorType({DT_INT32}))
- .ATTR(pad_to_max_output_size, Bool, false)
- .OP_END_FACTORY_REG(NonMaxSuppressionV4)
-
- /**
- *@brief Greedily selects a subset of bounding boxes in descending order of \n
- score.
-
- *@par Inputs:
- *Input overlaps and scores must be float type. Inputs include: \n
- *@li overlaps: A 2-D float tensor of shape [num_boxes, num_boxes] \n
- representing the n-by-n box overlap values.
- *@li scores: A 1-D float tensor of shape [num_boxes] representing a single \n
- score corresponding to each box (each row of boxes).
- *@li max_output_size: A scalar integer tensor representing the maximum number \n
- of boxes to be selected by non max suppression.
- *@li overlap_threshold: A 0-D float tensor representing the threshold for \n
- deciding whether boxes overlap too.
- *@li score_threshold: A 0-D float tensor representing the threshold for \n
- deciding when to remove boxes based on score.
-
- *@par Attributes:
- *pad_to_max_output_size: If true, the output selected_indices is padded \n
- to be of length max_output_size. Defaults to false.
-
- *@par Outputs:
- *selected_indices: A 1-D integer tensor of shape [M] representing the \n
- selected indices from the boxes tensor, where M <= max_output_size.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow NonMaxSuppressionWithOverlaps operator.
- */
-
- REG_OP(NonMaxSuppressionWithOverlaps)
- .INPUT(overlaps, TensorType({DT_FLOAT}))
- .INPUT(scores, TensorType({DT_FLOAT}))
- .INPUT(max_output_size, TensorType({DT_INT32}))
- .INPUT(overlap_threshold, TensorType({DT_FLOAT}))
- .INPUT(score_threshold, TensorType({DT_FLOAT}))
- .OUTPUT(selected_indices, TensorType({DT_INT32}))
- .OP_END_FACTORY_REG(NonMaxSuppressionWithOverlaps)
-
- /**
- *@brief JPEG-encode an image.
-
- *@par Inputs:
- *Input image must be unit8 type. Inputs include: \n
- *image: A 3-D uint8 Tensor of shape [height, width, channels].
-
- *@par Attributes:
- *@li format: Per pixel image format.
- *@li quality: Quality of the compression from 0 to 100 (higher is better \n
- and slower).
- *@li progressive: If True, create a JPEG that loads progressively (coarse \n
- to fine).
- *@li optimize_size: If True, spend CPU/RAM to reduce size with no quality \n
- change.
- *@li chroma_downsampling: A boolean, default is true.
- *@li density_unit: Unit used to specify x_density and y_density: pixels per \n
- inch ('in') or centimeter ('cm').
- *@li x_density: Horizontal pixels per density unit.
- *@li y_density: Vertical pixels per density unit.
- *@li xmp_metadata: If not empty, embed this XMP metadata in the image header.
-
- *@par Outputs:
- *contents: 0-D. JPEG-encoded image.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow EncodeJpeg operator.
- */
-
- REG_OP(EncodeJpeg)
- .INPUT(image, TensorType({DT_UINT8}))
- .OUTPUT(contents, TensorType({DT_STRING}))
- .ATTR(format, String, "")
- .ATTR(quality, Int, 95)
- .ATTR(progressive, Bool, false)
- .ATTR(optimize_size, Bool, false)
- .ATTR(chroma_downsampling, Bool, true)
- .ATTR(density_unit, String, "in")
- .ATTR(x_density, Int, 300)
- .ATTR(y_density, Int, 300)
- .ATTR(xmp_metadata, String, "")
- .OP_END_FACTORY_REG(EncodeJpeg)
-
- /**
- *@brief PNG-encode an image.
- *@par Inputs:
- *Input image must be unit8 or uint16 type. Inputs include: \n
- *image: is a 3-D uint8 or uint16 Tensor of shape [height, width, channels] \n
- where channels is: 1: for grayscale; 2: for grayscale + alpha; 3: for RGB; \n
- 4: for RGBA.
-
- *@par Attributes:
- *compression: Compression level.
-
- *@par Outputs:
- *contents: 0-D. PNG-encoded image.
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow EncodePng operator.
- */
-
- REG_OP(EncodePng)
- .INPUT(image, TensorType({DT_UINT8, DT_UINT16}))
- .OUTPUT(contents, TensorType({DT_STRING}))
- .ATTR(compression, Int, -1)
- .OP_END_FACTORY_REG(EncodePng)
-
- /**
- *@brief Resizes "images" to "size" using bilinear interpolation.
-
- *@par Inputs:
- * One input:
- *x: An NC1HWC0 Tensor. \n
- * Must be one of the following types: float16, float32.
-
- *@par Attributes:
- *@li size: A required int32 Tensor specifying the new size for the images. \n
- No default value.
- *@li align_corners: An optional bool. If "true", the centers of the corner \n
- pixels of the input and output tensors are aligned. Defaults to "false".
-
- *@par Outputs:
- *y: A Tensor with type float32 and the same format as input "images".
-
- *@attention Constraints:
- *@li The input "size" must be a tensor of 2 elements: size[0] <= 2048, \n
- size[1] <= 2048.
- *@li The input "images" must be a tensor of 5 elements: images[2] <= 2048, \n
- images[3] <= 2048.
-
- *@par Third-party framework compatibility
- * Compatible with TensorFlow operator ResizeBilinearV2D.
- */
- REG_OP(ResizeBilinearV2D)
- .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .REQUIRED_ATTR(size, ListInt)
- .OP_END_FACTORY_REG(ResizeBilinearV2D)
-
- /**
- *@brief Resizes "images" to "size" using bilinear interpolation and keep ration at the time.
-
- *@par Inputs:
- * One input:
- *images: An NC1HWC0 Tensor. \n
- * Must be one of the following types: float16, float32.
-
- *@par Attributes:
- *@li min_dimension: A required int32 attribute for the min dimension for the images.
- * No default value.
- *@li max_dimension: A required int32 attribute for the max dimension for the images.
- * No default value.
- *@li align_corners: An optional bool. If "true", the centers of the corner
- * pixels of the input and output tensors are aligned. Defaults to "false".
- *@li half_pixel_centers: indicates if the offset coordinates are normalized
- * Defaults to "false".
-
- *@par Outputs:
- *y: A Tensor with type float32 and the same format as input "images".
-
- *@attention Constraints:
- * The input "images" must be a tensor of 5 elements: images[2] <= 2048, \n
- images[3] <= 2048.
- */
- REG_OP(KeepRationResizeBilinear)
- .INPUT(images, TensorType({DT_FLOAT16, DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .REQUIRED_ATTR(min_dimension, Int)
- .REQUIRED_ATTR(max_dimension, Int)
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(KeepRationResizeBilinear)
-
- /**
- *@brief Resizes "images" to "size" using nearest neighbor interpolation.
-
- *@par Inputs:
- * One input:
- *x: An NC1HWC0 Tensor. \n
- * Must be one of the following types: float16, float32, int32, int8, uint8
-
- *@par Attributes:
- *@li size: A required int32 Tensor specifying the new size for the images. \n
- No default value.
- *@li align_corners: An optional bool. If "true", the centers of the corner \n
- pixels of the input and output tensors are aligned. Defaults to "false".
-
- *@par Outputs:
- *y: A Tensor with the same type and format as input "images".
-
- *@attention Constraints:
- * The input "size" must be a tensor of 2 elements: size[0] <= 7680, \n
- size[1] <= 4320
-
- *@par Third-party framework compatibility
- * Compatible with TensorFlow operator ResizeNearestNeighborV2.
- */
- REG_OP(ResizeNearestNeighborV2D)
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
- .REQUIRED_ATTR(size, ListInt)
- .ATTR(align_corners, Bool, false)
- .ATTR(half_pixel_centers, Bool, false)
- .OP_END_FACTORY_REG(ResizeNearestNeighborV2D)
-
- /**
- *@brief Extract the shape information of a JPEG-encoded image.
-
- *@par Inputs:
- *Input contents must be 0-D. Inputs include: \n
- *contents: 0-D. The JPEG-encoded image.
-
- *@par Attributes:
- *output_type: The output type of the operation (int32 or int64). Defaults \n
- to int32.
-
- *@par Outputs:
- *image_shape: 1-D. The image shape with format [height, width, channels].
-
- *@par Third-party framework compatibility
- *Compatible with tensorflow ExtractJpegShape operator.
- */
-
- REG_OP(ExtractJpegShape)
- .INPUT(contents, TensorType({DT_STRING}))
- .OUTPUT(image_shape, TensorType({DT_INT32, DT_INT64}))
- .REQUIRED_ATTR(output_type, Type)
- .OP_END_FACTORY_REG(ExtractJpegShape)
-
- /**
- *@brief Draw bounding boxes on a batch of images.
-
- *@par Inputs:
- *@li images: 4-D with shape `[batch, height, width, depth]`. \n
- A batch of images.
- *@li boxes: 3-D with shape `[batch, num_bounding_boxes, 4]` \n
- containing bounding boxes.
- *@li colors: 2-D. A list of RGBA colors to cycle through for the boxes.
-
- *@par Outputs:
- *y: Returns 4-D with the same shape as `images`. \n
- The batch of input images with bounding boxes drawn on the images.
-
- *@par Third-party framework compatibility
- * Compatible with tensorflow DrawBoundingBoxesV2 operator.
- */
-
- REG_OP(DrawBoundingBoxesV2)
- .INPUT(images, TensorType({DT_FLOAT}))
- .INPUT(boxes, TensorType({DT_FLOAT}))
- .INPUT(colors, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .OP_END_FACTORY_REG(DrawBoundingBoxesV2)
-
- /**
- *@brief Greedily selects a subset of bounding boxes in descending order of score, \n
- pruning away boxes that have high intersection-over-union (IOU) overlap \n
- with previously selected boxes.
-
- *@par Inputs:
- *@li boxes: A 2-D float tensor of shape `[num_boxes, 4]`.
- *@li scores: A 1-D float tensor of shape `[num_boxes]` representing a single \n
- score corresponding to each box (each row of boxes).
- *@li max_output_size: A scalar integer tensor representing the maximum number of \n
- boxes to be selected by non max suppression.
- *@li iou_threshold: A 0-D float tensor representing the threshold for deciding whether \n
- boxes overlap too much with respect to IOU.
- *@li score_threshold: A 0-D float tensor representing the threshold for deciding when to \n
- remove boxes based on score.
- *@li soft_nms_sigma: A 0-D float tensor representing the sigma parameter for Soft NMS.
-
- *@par Attributes:
- pad_to_max_output_size: If true, the output `selected_indices` is padded to be of length \n
- `max_output_size`. Defaults to false. If not specified, defaults to false.
-
- *@par Outputs:
- *@li selected_indices: A 1-D integer tensor of shape [M] representing the \n
- selected indices from the boxes tensor, where M <= max_output_size.
- *@li selected_scores: A 1-D float tensor of shape `[M]` representing the corresponding \n
- scores for each selected box, where `M <= max_output_size`.
- *@li valid_outputs: A 0-D integer tensor representing the number of valid \n
- elements in selected_indices, with the valid elements appearing first.
-
- *@par Third-party framework compatibility
- * Compatible with tensorflow NonMaxSuppressionV5 operator.
- */
-
- REG_OP(NonMaxSuppressionV5)
- .INPUT(boxes, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(scores, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(max_output_size, TensorType({DT_INT32}))
- .INPUT(iou_threshold, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(score_threshold, TensorType({DT_FLOAT16, DT_FLOAT}))
- .INPUT(soft_nms_sigma, TensorType({DT_FLOAT16, DT_FLOAT}))
- .OUTPUT(selected_indices, TensorType({DT_INT32}))
- .OUTPUT(selected_scores, TensorType({DT_FLOAT16, DT_FLOAT}))
- .OUTPUT(valid_outputs, TensorType({DT_INT32}))
- .ATTR(pad_to_max_output_size, Bool, false)
- .REQUIRED_ATTR(T, Type)
- .OP_END_FACTORY_REG(NonMaxSuppressionV5)
-
- /**
- *@brief Resizes "images" to "size" by scale and translate.
-
- *@par Inputs:
- *@li images: A `Tensor`. Must be one of the following types: `int8`, `uint8`, \n
- `int16`, `uint16`, `int32`, `int64`, `bfloat16`, `half`, `float32`, `float64`.
- *@li size: A `Tensor` of type `int32`.
- *@li scale: A `Tensor` of type `float32`.
- *@li translation: A `Tensor` of type `float32`.
-
- *@par Outputs:
- *y: A Tensor with type float32.
-
- *@par Third-party framework compatibility
- * Compatible with TensorFlow ScaleAndTranslate operator.
- */
-
- REG_OP(ScaleAndTranslate)
- .INPUT(images, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16,
- DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(size, TensorType({DT_INT32}))
- .INPUT(scale, TensorType({DT_FLOAT}))
- .INPUT(translation, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(kernel_type, String, "lanczos3")
- .ATTR(antialias, Bool, true)
- .OP_END_FACTORY_REG(ScaleAndTranslate)
-
- /**
- *@brief Computes the gradient by scale and translate.
-
- *@par Inputs:
- *@li grads: A `Tensor`. Must be one of the following types: `float32`.
- *@li original_image: A `Tensor`. Must have the same type as `grads`.
- *@li scale: A `Tensor` of type `float32`.
- *@li translation: A `Tensor` of type `float32`.
-
- *@par Outputs:
- *y: A `Tensor`. Has the same type as `grads`.
-
- *@par Third-party framework compatibility
- * Compatible with TensorFlow ScaleAndTranslateGrad operator.
- */
-
- REG_OP(ScaleAndTranslateGrad)
- .INPUT(grads, TensorType({DT_FLOAT}))
- .INPUT(original_image, TensorType({DT_FLOAT}))
- .INPUT(scale, TensorType({DT_FLOAT}))
- .INPUT(translation, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT}))
- .ATTR(kernel_type, String, "lanczos3")
- .ATTR(antialias, Bool, true)
- .OP_END_FACTORY_REG(ScaleAndTranslateGrad)
-
- /**
- *@brief Greedily selects a subset of bounding boxes in descending order of score, \n
- This operation performs non_max_suppression on the inputs per batch, across all classes.
-
- *@par Inputs:
- *@li boxes: A 4-D float tensor of shape `[batch_size, num_boxes, q, 4]`. If `q` is 1 then \n
- same boxes are used for all classes otherwise, if `q` is equal to number of \n
- classes, class-specific boxes are used.
- *@li scores: A 3-D float tensor of shape `[batch_size, num_boxes, num_classes]` \n
- representing a single score corresponding to each box (each row of boxes).
- *@li max_output_size_per_class: A scalar integer tensor representing the maximum number of \n
- boxes to be selected by non max suppression per class.
- *@li max_total_size: A scalar representing maximum number of boxes retained over all classes. \n
- *@li iou_threshold: A 0-D float tensor representing the threshold for deciding whether \n
- boxes overlap too much with respect to IOU.
- *@li score_threshold: A 0-D float tensor representing the threshold for deciding when to remove \n
- boxes based on score.
-
- *@par Attributes:
- *@li pad_per_class: If false, the output nmsed boxes, scores and classes \n
- are padded/clipped to `max_total_size`. If true, the \n
- output nmsed boxes, scores and classes are padded to be of length \n
- `max_size_per_class`*`num_classes`, unless it exceeds `max_total_size` in \n
- which case it is clipped to `max_total_size`. Defaults to false.
- *@li clip_boxes: If true, assume the box coordinates are between [0, 1] and clip the output boxes \n
- if they fall beyond [0, 1]. If false, do not do clipping and output the box \n
- coordinates as it is. If not specified, defaults to true.
-
- *@par Outputs:
- *y: A 1-D integer tensor of shape `[M]` representing the selected \n
- indices from the boxes tensor, where `M <= max_output_size`.
-
- *@par Third-party framework compatibility
- * Compatible with tensorflow CombinedNonMaxSuppression operator.
- */
-
- REG_OP(CombinedNonMaxSuppression)
- .INPUT(boxes, TensorType({DT_FLOAT}))
- .INPUT(scores, TensorType({DT_FLOAT}))
- .INPUT(max_output_size_per_class, TensorType({DT_INT32}))
- .INPUT(max_total_size, TensorType({DT_INT32}))
- .INPUT(iou_threshold, TensorType({DT_FLOAT}))
- .INPUT(score_threshold, TensorType({DT_FLOAT}))
- .OUTPUT(nmsed_boxes, TensorType({DT_FLOAT}))
- .OUTPUT(nmsed_scores, TensorType({DT_FLOAT}))
- .OUTPUT(nmsed_classes, TensorType({DT_FLOAT}))
- .OUTPUT(valid_detections, TensorType({DT_INT32}))
- .ATTR(pad_per_class, Bool, false)
- .ATTR(clip_boxes, Bool, true)
- .OP_END_FACTORY_REG(CombinedNonMaxSuppression)
-
- /**
- *@brief Function spatial transformer.
-
- *@par Inputs:
- *@li x: A Tensor dtype of float16, float32.
- *@li theta: A Tensor dtype of float16, float32, auxiliary coefficients.
-
- *@par Attributes:
- *@li output_size: A tuple output size.
- *@li default_theta: A tuple default theta
- *@li use_default_theta: List use default theta
- *@li align_corners: Align corners
-
- *@par Outputs:
- *y: A Tensor dtype of float16, float32, should be same shape and type as x.
- */
- REG_OP(SpatialTransformerD)
- .INPUT(x, TensorType({DT_FLOAT,DT_FLOAT16}))
- .OPTIONAL_INPUT(theta, TensorType({DT_FLOAT,DT_FLOAT16}))
- .OUTPUT(y, TensorType({DT_FLOAT,DT_FLOAT16}))
- .ATTR(output_size, ListInt, {-1, -1})
- .ATTR(default_theta, ListFloat, {})
- .ATTR(align_corners, Bool, false)
- .ATTR(use_default_theta, ListBool, {})
- .OP_END_FACTORY_REG(SpatialTransformerD)
-
- } // namespace ge
-
- #endif // GE_OP_MAGE_OPS_H_
|