You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

image_ops.h 73 kB

5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
5 years ago
5 years ago
4 years ago
4 years ago
5 years ago
4 years ago
4 years ago
5 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944
  1. /**
  2. * Copyright 2019 Huawei Technologies Co., Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /*!
  17. * \file image_ops.h
  18. * \brief
  19. */
  20. #ifndef OPS_BUILT_IN_OP_PROTO_INC_IMAGE_OPS_H_
  21. #define OPS_BUILT_IN_OP_PROTO_INC_IMAGE_OPS_H_
  22. #include "graph/operator_reg.h"
  23. namespace ge {
  24. /**
  25. *@brief Decode the frame(s) of a GIF-encoded image to a uint8 tensor . \n
  26. *@par Inputs:
  27. *@li contents:A Tensor of type string. 0-D. The GIF-encoded image. \n
  28. *@par Outputs:
  29. *image:A Tensor of type uint8. \n
  30. *@par Third-party framework compatibility
  31. *Compatible with tensorflow DecodeGif operator.
  32. */
  33. REG_OP(DecodeGif)
  34. .INPUT(contents, TensorType({DT_STRING}))
  35. .OUTPUT(image, TensorType({DT_UINT8}))
  36. .OP_END_FACTORY_REG(DecodeGif)
  37. /**
  38. *@brief Adjust the hue of one or more images . \n
  39. *@par Inputs:
  40. *Input images is a tensor of at least 3 dimensions. The last dimension is
  41. interpretted as channels, and must be three. Inputs include:
  42. *@li images:A Tensor of type float. Images to adjust. At least 3-D. The format
  43. must be NHWC.
  44. *@li delta:A Tensor of type float. A float delta to add to the hue . \n
  45. *@par Outputs:
  46. *y:A Tensor of type float. The format must be NHWC. \n
  47. *@attention Constraints:
  48. *Input images is a tensor of at least 3 dimensions. The last dimension is
  49. interpretted as channels, and must be three . \n
  50. *@par Third-party framework compatibility
  51. *Compatible with tensorflow AdjustHue operator.
  52. */
  53. REG_OP(AdjustHue)
  54. .INPUT(images, TensorType({DT_FLOAT16,DT_FLOAT}))
  55. .INPUT(delta, TensorType({DT_FLOAT}))
  56. .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
  57. .OP_END_FACTORY_REG(AdjustHue)
  58. /**
  59. *@brief Adjust the saturation of one or more images . \n
  60. *@par Inputs:
  61. *Input images is a tensor of at least 3 dimensions. The last dimension is
  62. interpretted as channels, and must be three. Inputs include:
  63. *@li images:A Tensor of type float. Images to adjust. At least 3-D. The format
  64. must be NHWC.
  65. *@li scale:A Tensor of type float. A float scale to add to the saturation . \n
  66. *@par Outputs:
  67. *y:A Tensor of type float. The format must be NHWC. \n
  68. *@attention Constraints:
  69. *Input images is a tensor of at least 3 dimensions. The last dimension is
  70. interpretted as channels, and must be three . \n
  71. *@par Third-party framework compatibility
  72. *Compatible with tensorflow AdjustSaturation operator.
  73. */
  74. REG_OP(AdjustSaturation)
  75. .INPUT(images, TensorType({DT_FLOAT16,DT_FLOAT}))
  76. .INPUT(scale, TensorType({DT_FLOAT}))
  77. .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
  78. .OP_END_FACTORY_REG(AdjustSaturation)
  79. /**
  80. *@brief Adjust the contrast of one or more images . \n
  81. *@par Inputs:
  82. *Input images is a tensor of at least 3 dimensions. The last 3 dimensions are
  83. interpreted as '[height, width, channels]'. Inputs include:
  84. *@li images:A Tensor of type float. Images to adjust. At least 3-D. The format
  85. must be NHWC.
  86. *@li scale:A Tensor of type float. A float multiplier for adjusting contrast . \n
  87. *@par Outputs:
  88. *y:A Tensor of type float. The format must be NHWC. \n
  89. *@attention Constraints:
  90. *Input images is a tensor of at least 3 dimensions. The last dimension is
  91. interpretted as channels, and must be three . \n
  92. *@par Third-party framework compatibility
  93. *Compatible with tensorflow AdjustContrast operator.
  94. */
  95. REG_OP(AdjustContrast)
  96. .INPUT(images, TensorType({DT_FLOAT16,DT_FLOAT}))
  97. .INPUT(contrast_factor, TensorType({DT_FLOAT}))
  98. .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
  99. .OP_END_FACTORY_REG(AdjustContrast)
  100. /**
  101. *@brief Extracts crops from the input image tensor and resizes them. Extracts
  102. crops from the input image tensor and resizes them using bilinear sampling or
  103. nearest neighbor sampling to a common output size specified by crop_size . \n
  104. *@par Inputs:
  105. *Input images must be a 4-D tensor. Inputs include:
  106. *@li images:A Tensor. Must be one of the following types:uint8, uint16, int8,
  107. int16, int32, int64, float16, float, double. A 4-D tensor of shape
  108. [batch, image_height, image_width, depth]. The format must be NHWC.
  109. *@li boxes: A Tensor of type float. A 2-D tensor of shape [num_boxes, 4].
  110. *@li box_index: A Tensor of type int32. A 1-D tensor of shape [num_boxes] with
  111. int32 values in [0, batch).
  112. *@li crop_size: A Tensor of type int32. A 1-D tensor of 2 elements, crop_size
  113. = [crop_height, crop_width]. All cropped image patches are resized to this size . \n
  114. *@par Attributes:
  115. *@li extrapolation_value: An optional float. Defaults to 0. Value used for
  116. extrapolation, when applicable.
  117. *@li method: An optional string from: '"bilinear", "nearest"'. Defaults to
  118. "bilinear". Currently two sampling methods are supported: Bilinear and
  119. NearestNeighbor . \n
  120. *@par Outputs:
  121. *y:A Tensor of type float. The format must be NHWC. \n
  122. *@attention Constraints:
  123. *Input images must be a 4-D tensor . \n
  124. *@par Third-party framework compatibility
  125. *Compatible with tensorflow CropAndResize operator.
  126. */
  127. REG_OP(CropAndResize)
  128. .INPUT(x, TensorType({DT_UINT8, DT_UINT16, DT_INT8, \
  129. DT_INT16, DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  130. .INPUT(boxes, TensorType({DT_FLOAT}))
  131. .INPUT(box_index, TensorType({DT_INT32}))
  132. .INPUT(crop_size, TensorType({DT_INT32}))
  133. .OUTPUT(y, TensorType({DT_FLOAT}))
  134. .ATTR(extrapolation_value, Float, 0)
  135. .ATTR(method, String, "bilinear")
  136. .OP_END_FACTORY_REG(CropAndResize)
  137. /**
  138. *@brief Extracts crops from the input image tensor and resizes them.
  139. * Extracts crops from the input image tensor and resizes them using bilinear sampling or
  140. * nearest neighbor sampling to a common output size specified by crop_size . \n
  141. *@par Inputs:
  142. *Input images must be a 5HD tensor. Inputs include:
  143. *@li x:A Tensor. Must be one of the following types:float16, float. A 5HD tensor of shape
  144. * [batch, C1, image_height, image_width, C0].
  145. *@li boxes: A Tensor of type float. A 2-D tensor of shape [num_boxes, 4].
  146. *@li box_index: A Tensor of type int32. A 1-D tensor of shape [num_boxes] with int32 values in [0, batch) . \n
  147. *@par Attributes:
  148. *@li crop_size: list int. [crop_height, crop_width]. All cropped image patches are resized to this size.
  149. *@li extrapolation_value: An optional float. Defaults to 0. Value used for extrapolation, when applicable.
  150. *@li method: An optional string from: '"bilinear"'. Defaults to "bilinear" . \n
  151. *@par Outputs:
  152. *y:A Tensor of type float . \n
  153. *@attention Constraints:
  154. *Input images must be a 5HD tensor . \n
  155. *@par Third-party framework compatibility
  156. *Compatible with tensorflow CropAndResize operator.
  157. * @par Restrictions:
  158. * Warning: THIS FUNCTION IS DEPRECATED. Please use CropAndResize instead.
  159. */
  160. REG_OP(CropAndResizeD)
  161. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
  162. .INPUT(boxes, TensorType({DT_FLOAT}))
  163. .INPUT(box_index, TensorType({DT_INT32}))
  164. .OUTPUT(y, TensorType({DT_FLOAT}))
  165. .REQUIRED_ATTR(crop_size, ListInt)
  166. .ATTR(extrapolation_value, Float, 0)
  167. .ATTR(method, String, "bilinear")
  168. .OP_END_FACTORY_REG(CropAndResizeD)
  169. /**
  170. *@brief Computes the gradient of the crop_and_resize op wrt the input
  171. boxes tensor . \n
  172. *@par Inputs:
  173. *Input images and grads must be a 4-D tensor. Inputs include:
  174. *@li grads: A 4-D tensor of shape [num_boxes, crop_height, crop_width, depth].
  175. The format must be NHWC.
  176. *@li images: A 4-D tensor of shape [batch, image_height, image_width, depth].
  177. The format must be NHWC.
  178. Both image_height and image_width need to be positive.
  179. *@li boxes: A 2-D tensor of shape [num_boxes, 4]. The i-th row of the tensor
  180. specifies the coordinates of a box in the box_ind[i] image and is specified in
  181. normalized coordinates [y1, x1, y2, x2].
  182. *@li box_index: A 1-D tensor of shape [num_boxes] with int32 values in
  183. [0, batch). The value of box_ind[i] specifies the image that the i-th box
  184. refers to . \n
  185. *@par Attributes:
  186. method: A string specifying the interpolation method. Only 'bilinear' is
  187. supported for now . \n
  188. *@par Outputs:
  189. *y:A 2-D tensor of shape [num_boxes, 4] . \n
  190. *@attention Constraints:
  191. *Input images and grads must be a 4-D tensor . \n
  192. *@par Third-party framework compatibility
  193. *Compatible with tensorflow CropAndResizeGradBoxes operator.
  194. */
  195. REG_OP(CropAndResizeGradBoxes)
  196. .INPUT(grads, TensorType({DT_FLOAT}))
  197. .INPUT(images, TensorType({DT_UINT8, DT_UINT16, DT_INT8, DT_INT16, \
  198. DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  199. .INPUT(boxes, TensorType({DT_FLOAT}))
  200. .INPUT(box_index, TensorType({DT_INT32}))
  201. .OUTPUT(y, TensorType({DT_FLOAT}))
  202. .ATTR(method, String, "bilinear")
  203. .OP_END_FACTORY_REG(CropAndResizeGradBoxes)
  204. /**
  205. *@brief Computes the gradient of the crop_and_resize op wrt the input
  206. images tensor . \n
  207. *@par Inputs:
  208. *Input grads must be a 4-D tensor. Inputs include:
  209. *@li grads: A 4-D tensor of shape [num_boxes, crop_height, crop_width, depth].
  210. The format must be NHWC.
  211. *@li boxes: A 2-D tensor of shape [num_boxes, 4]. The i-th row of the tensor
  212. specifies the coordinates of a box in the box_ind[i] image and is specified
  213. in normalized coordinates [y1, x1, y2, x2].
  214. *@li box_index: A 1-D tensor of shape [num_boxes] with int32 values in
  215. [0, batch). The value of box_ind[i] specifies the image that the i-th box
  216. refers to.
  217. *@li image_size: A 1-D tensor with value [batch, image_height, image_width,
  218. depth] containing the original image size. Both image_height and image_width
  219. need to be positive . \n
  220. *@par Attributes:
  221. method: A string specifying the interpolation method. Only 'bilinear' is
  222. supported for now . \n
  223. *@par Outputs:
  224. *y:A 4-D tensor of shape [batch, image_height, image_width, depth]. The format
  225. must be NHWC. \n
  226. *@attention Constraints:
  227. *Input grads must be a 4-D tensor . \n
  228. *@par Third-party framework compatibility
  229. *Compatible with tensorflow CropAndResizeGradImage operator.
  230. */
  231. REG_OP(CropAndResizeGradImage)
  232. .INPUT(grads, TensorType({DT_FLOAT}))
  233. .INPUT(boxes, TensorType({DT_FLOAT}))
  234. .INPUT(box_index, TensorType({DT_INT32}))
  235. .INPUT(image_size, TensorType({DT_INT32}))
  236. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  237. .ATTR(method, String, "bilinear")
  238. .REQUIRED_ATTR(T, Type)
  239. .OP_END_FACTORY_REG(CropAndResizeGradImage)
  240. /**
  241. *@brief Extracts a glimpse from the input tensor . \n
  242. *@par Inputs:
  243. *Input x must be a 4-D tensor. Inputs include:
  244. *@li x: A 4-D float tensor of shape [batch_size, height, width, channels].
  245. The format must be NHWC.
  246. *@li size: A 1-D tensor of 2 elements containing the size of the glimpses to
  247. extract. The glimpse height must be specified first, following by the glimpse
  248. width.
  249. *@li offsets: A 2-D integer tensor of shape [batch_size, 2] containing the y,
  250. x locations of the center of each window . \n
  251. *@par Attributes:
  252. *@li centered: indicates if the offset coordinates are centered relative to
  253. the image, in which case the (0, 0) offset is relative to the center of the
  254. input images. If false, the (0,0) offset corresponds to the upper left corner
  255. of the input images.
  256. *@li normalized: indicates if the offset coordinates are normalized.
  257. *@li uniform_noise: indicates if the noise should be generated using a
  258. uniform distribution or a Gaussian distribution.
  259. *@li noise: indicates if the noise should uniform, gaussian, or zero.
  260. The default is uniform which means the the noise type will be decided by
  261. uniform_noise . \n
  262. *@par Outputs:
  263. *y:A tensor representing the glimpses [batch_size, glimpse_height,
  264. glimpse_width, channels]. The format must be NHWC. \n
  265. *@attention Constraints:
  266. *Input x must be a 4-D tensor . \n
  267. *@par Third-party framework compatibility
  268. *Compatible with tensorflow CropAndResizeGradImage operator.
  269. */
  270. REG_OP(ExtractGlimpse)
  271. .INPUT(x, TensorType({DT_FLOAT}))
  272. .INPUT(size, TensorType({DT_INT32}))
  273. .INPUT(offsets, TensorType({DT_FLOAT}))
  274. .OUTPUT(y, TensorType({DT_FLOAT}))
  275. .ATTR(centered, Bool, true)
  276. .ATTR(normalized, Bool, true)
  277. .ATTR(uniform_noise, Bool, true)
  278. .ATTR(noise, String, "uniform")
  279. .OP_END_FACTORY_REG(ExtractGlimpse)
  280. /**
  281. *@brief Convert one or more images from HSV to RGB . \n
  282. *@par Inputs:
  283. *Last dimension of input x must be size 3. Inputs include:
  284. *images: 1-D or higher rank. HSV data to convert. Last dimension must be size 3 . \n
  285. *@par Outputs:
  286. *y:images converted to RGB . \n
  287. *@attention Constraints:
  288. *Last dimension of input x must be size 3 . \n
  289. *@par Third-party framework compatibility
  290. *Compatible with tensorflow HSVToRGB operator.
  291. */
  292. REG_OP(HSVToRGB)
  293. .INPUT(images, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE}))
  294. .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE}))
  295. .OP_END_FACTORY_REG(HSVToRGB)
  296. /**
  297. *@brief Resize quantized images to size using quantized bilinear interpolation . \n
  298. *@par Inputs:
  299. *Input images must be a 4-D tensor. Inputs include:
  300. *@li images: 4-D with shape [batch, height, width, channels]. The format must
  301. be NHWC.
  302. *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width. The new
  303. size for the images.
  304. *@li min: A Tensor of type float.
  305. *@li max: A Tensor of type float . \n
  306. *@par Attributes:
  307. *@li align_corners: An optional bool. Defaults to False. If true, the centers
  308. of the 4 corner pixels of the input and output tensors are aligned, preserving
  309. the values at the corner pixels. Defaults to false.
  310. *@li half_pixel_centers: indicates if the offset coordinates are normalized . \n
  311. *@par Outputs:
  312. *@li resized_images: 4-D with shape [batch, new_height, new_width, channels].
  313. The format must be NHWC.
  314. *@li y_min: A Tensor of type float.
  315. *@li y_max: A Tensor of type float . \n
  316. *@attention Constraints:
  317. *Input images and output images must be quantized types . \n
  318. *@par Third-party framework compatibility
  319. *Compatible with tensorflow QuantizedResizeBilinear operator.
  320. */
  321. REG_OP(QuantizedResizeBilinear)
  322. .INPUT(images, TensorType({DT_QUINT8,DT_QINT32,DT_FLOAT}))
  323. .INPUT(size, TensorType({ DT_INT32 }))
  324. .INPUT(min, TensorType({ DT_FLOAT }))
  325. .INPUT(max, TensorType({ DT_FLOAT }))
  326. .OUTPUT(resized_images, TensorType({DT_QUINT8,DT_QINT32,DT_FLOAT }))
  327. .OUTPUT(y_min, TensorType({ DT_FLOAT }))
  328. .OUTPUT(y_max, TensorType({ DT_FLOAT }))
  329. .ATTR(align_corners, Bool, false)
  330. .ATTR(half_pixel_centers, Bool, false)
  331. .OP_END_FACTORY_REG(QuantizedResizeBilinear)
  332. /**
  333. *@brief Resize images to size using area interpolation . \n
  334. *@par Inputs:
  335. *Input images must be a 4-D tensor. Inputs include:
  336. *@li images: 4-D with shape [batch, height, width, channels]. The format must
  337. be NHWC.
  338. *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width.
  339. The new size for the images . \n
  340. *@par Attributes:
  341. *align_corners: If true, the centers of the 4 corner pixels of the input and
  342. output tensors are aligned, preserving the values at the corner pixels.
  343. Defaults to false . \n
  344. *@par Outputs:
  345. *y: 4-D with shape [batch, new_height, new_width, channels]. The format must
  346. be NHWC. \n
  347. *@attention Constraints:
  348. *Input images can be of different types but output images are always float . \n
  349. *@par Third-party framework compatibility
  350. *Compatible with tensorflow ResizeArea operator.
  351. */
  352. REG_OP(ResizeArea)
  353. .INPUT(images, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, \
  354. DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  355. .INPUT(size, TensorType({DT_INT32}))
  356. .OUTPUT(y, TensorType({DT_FLOAT}))
  357. .ATTR(align_corners, Bool, false)
  358. .OP_END_FACTORY_REG(ResizeArea)
  359. /**
  360. *@brief Computes the gradient of bicubic interpolation . \n
  361. *@par Inputs:
  362. *Input grads must be a 4-D tensor. Inputs include:
  363. *@li grads: A Tensor of type float. 4-D with shape [batch, height, width,
  364. channels]. The format must be NHWC.
  365. *@li original_image: A Tensor. Must be one of the following types: float,
  366. double. 4-D with shape [batch, orig_height, orig_width, channels], The image
  367. tensor that was resized. The format must be NHWC. \n
  368. *@par Attributes:
  369. *@li align_corners: An optional bool. Defaults to False. If true, the centers
  370. of the 4 corner pixels of the input and grad tensors are aligned. Defaults to
  371. false.
  372. *@li half_pixel_centers: An optional bool. Defaults to False . \n
  373. *@par Outputs:
  374. *y: A Tensor. Has the same type as original_image. The format must be NHWC. \n
  375. *@attention Constraints:
  376. *Input images can be of different types but output images are always float .
  377. *@par Third-party framework compatibility
  378. *Compatible with tensorflow ResizeBicubicGrad operator.
  379. */
  380. REG_OP(ResizeBicubicGrad)
  381. .INPUT(grads, TensorType({DT_FLOAT}))
  382. .INPUT(original_image, TensorType({DT_FLOAT, DT_DOUBLE}))
  383. .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE}))
  384. .ATTR(align_corners, Bool, false)
  385. .ATTR(half_pixel_centers, Bool, false)
  386. .OP_END_FACTORY_REG(ResizeBicubicGrad)
  387. /**
  388. *@brief Resize images to size using bicubic interpolation . \n
  389. *@par Inputs:
  390. *Input images must be a 4-D tensor. Inputs include:
  391. *@li images: 4-D with shape [batch, height, width, channels]. The format
  392. must be NHWC.
  393. *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width. The new
  394. size for the images . \n
  395. *@par Attributes:
  396. *@li align_corners: If true, the centers of the 4 corner pixels of the input
  397. and output tensors are aligned, preserving the values at the corner pixels.
  398. Defaults to false.
  399. *@li half_pixel_centers: An optional bool. Defaults to False . \n
  400. *@par Outputs:
  401. *y: 4-D with shape [batch, new_height, new_width, channels]. The format
  402. must be NHWC. \n
  403. *@attention Constraints:
  404. *Input images can be of different types but output images are always float .
  405. *@par Third-party framework compatibility
  406. *Compatible with tensorflow ResizeBicubic operator.
  407. */
  408. REG_OP(ResizeBicubic)
  409. .INPUT(images, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, \
  410. DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  411. .INPUT(size, TensorType({DT_INT32}))
  412. .OUTPUT(y, TensorType({DT_FLOAT}))
  413. .ATTR(align_corners, Bool, false)
  414. .ATTR(half_pixel_centers, Bool, false)
  415. .OP_END_FACTORY_REG(ResizeBicubic)
  416. /**
  417. *@brief Computes the gradient of nearest neighbor interpolation . \n
  418. *@par Inputs:
  419. *Input grads must be a 4-D tensor. Inputs include:
  420. *@li grads: A Tensor. Must be one of the following types: uint8, int8, int32,
  421. float16, float, double. Must set the format, supported format list ["NCHW, NHWC"]
  422. *@li size: A 1-D int32 Tensor of 2 elements: orig_height, orig_width.
  423. The original input size . \n
  424. *@par Attributes:
  425. *@li align_corners: An optional bool. Defaults to False. If true, the centers
  426. of the 4 corner pixels of the input and grad tensors are aligned. Defaults to
  427. false.
  428. *@li half_pixel_centers: An optional bool. Defaults to False . \n
  429. *@par Outputs:
  430. *y: A Tensor. Has the same type as grads . \n
  431. *@attention Constraints:
  432. *Input grads must be a 4-D tensor . \n
  433. *@par Third-party framework compatibility
  434. *Compatible with tensorflow ResizeNearestNeighborV2Grad operator.
  435. */
  436. REG_OP(ResizeNearestNeighborV2Grad)
  437. .INPUT(grads, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32,
  438. DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  439. .INPUT(size, TensorType({DT_INT32}))
  440. .OUTPUT(y, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32,
  441. DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  442. .ATTR(align_corners, Bool, false)
  443. .ATTR(half_pixel_centers, Bool, false)
  444. .OP_END_FACTORY_REG(ResizeNearestNeighborV2Grad)
  445. /**
  446. *@brief Computes the gradient of nearest neighbor interpolation . \n
  447. *@par Inputs:
  448. *Input grads must be a 4-D tensor. Inputs include:
  449. *grads: A Tensor. 4-D with shape [batch, height, width, channels].
  450. *@par Attributes:
  451. *@li align_corners: An optional bool. Defaults to False. If true, the centers
  452. of the 4 corner pixels of the input and grad tensors are aligned. Defaults to
  453. false.
  454. *@li size: An list type. Specify the images size . \n
  455. *@par Outputs:
  456. *y: A Tensor. Has the same type as grads . \n
  457. *@par Third-party framework compatibility
  458. *Compatible with tensorflow ResizeNearestNeighborV2GradD operator.
  459. *
  460. * @par Restrictions:
  461. * Warning: THIS FUNCTION IS DEPRECATED. Please use ResizeNearestNeighborV2Grad instead.
  462. */
  463. REG_OP(ResizeNearestNeighborV2GradD)
  464. .INPUT(grads, TensorType({DT_FLOAT}))
  465. .OUTPUT(y, TensorType({DT_FLOAT}))
  466. .REQUIRED_ATTR(size, ListInt)
  467. .ATTR(align_corners, Bool, false)
  468. .ATTR(half_pixel_centers, Bool, false)
  469. .OP_END_FACTORY_REG(ResizeNearestNeighborV2GradD)
  470. /**
  471. *@brief Computes the gradient of bilinear interpolation . \n
  472. *@par Inputs:
  473. *Input grads must be a 4-D tensor. Inputs include:
  474. *@li grads: A Tensor of type float32. Must set the format, supported format list ["NCHW, NHWC"]
  475. *@li original_image: A Tensor. 4-D shape. Must set the format, supported format list ["NCHW, NHWC"]
  476. channels], The image tensor that was resized . \n
  477. *@par Attributes:
  478. *@li align_corners: An optional bool. Defaults to False. If true, the centers of
  479. the 4 corner pixels of the input and grad tensors are aligned. Defaults to
  480. false .
  481. *@li half_pixel_centers: indicates if the offset coordinates are normalized. Defaults
  482. to false . \n
  483. *@par Outputs:
  484. *y: A Tensor. Has the same type as original_image . \n
  485. *@attention Constraints:
  486. *Input grads must be a 4-D tensor . \n
  487. *@par Third-party framework compatibility
  488. *Compatible with tensorflow ResizeBilinearV2Grad operator.
  489. */
  490. REG_OP(ResizeBilinearV2Grad)
  491. .INPUT(grads, TensorType({DT_FLOAT}))
  492. .INPUT(original_image, TensorType::FloatingDataType())
  493. .OUTPUT(y, TensorType({DT_FLOAT}))
  494. .ATTR(align_corners, Bool, false)
  495. .ATTR(half_pixel_centers, Bool, false)
  496. .OP_END_FACTORY_REG(ResizeBilinearV2Grad)
  497. /**
  498. *@brief Resize images to size using bilinear interpolation . \n
  499. *@par Inputs:
  500. *Input images must be a 4-D tensor. Inputs include:
  501. *@li x: 4-D tensor. Must set the format, supported format list ["NCHW, NHWC"]
  502. *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width. The new
  503. size for the images . \n
  504. *@par Attributes:
  505. *align_corners: If true, the centers of the 4 corner pixels of the input and
  506. output tensors are aligned, preserving the values at the corner pixels.
  507. Defaults to false . \n
  508. *@par Outputs:
  509. *y: 4-D with shape [batch, new_height, new_width, channels] . \n
  510. *@attention Constraints:
  511. *Input images can be of different types but output images are always float . \n
  512. *@par Third-party framework compatibility
  513. *Compatible with tensorflow ResizeBilinearV2 operator.
  514. */
  515. REG_OP(ResizeBilinearV2)
  516. .INPUT(x, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16,
  517. DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  518. .INPUT(size, TensorType({DT_INT32}))
  519. .OUTPUT(y, TensorType({DT_FLOAT}))
  520. .ATTR(align_corners, Bool, false)
  521. .ATTR(half_pixel_centers, Bool, false)
  522. .OP_END_FACTORY_REG(ResizeBilinearV2)
  523. /**
  524. *@brief Converts one or more images from RGB to HSV . \n
  525. *@par Inputs:
  526. *Last dimension of input images must be size 3. Inputs include:
  527. *images: A Tensor. Must be one of the following types: float, double. 1-D or
  528. higher rank. RGB data to convert. Last dimension must be size 3 . \n
  529. *@par Outputs:
  530. *y: A Tensor. Has the same type as images . \n
  531. *@attention Constraints:
  532. *Outputs a tensor of the same shape as the images tensor, containing the HSV
  533. value of the pixels. The output is only well defined if the value in images
  534. are in [0,1] . \n
  535. *@par Third-party framework compatibility
  536. *Compatible with tensorflow RGBToHSV operator.
  537. */
  538. REG_OP(RGBToHSV)
  539. .INPUT(images, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE }))
  540. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE }))
  541. .OP_END_FACTORY_REG(RGBToHSV)
  542. /**
  543. *@brief Generate a single randomly distorted bounding box for an image . \n
  544. *@par Inputs:
  545. *Input images must be a 4-D tensor. Inputs include:
  546. *@li image_size: 1-D, containing [height, width, channels].
  547. *@li bounding_boxes: 3-D with shape [batch, N, 4] describing the N bounding
  548. boxes associated with the image. \n
  549. *@par Attributes:
  550. *@li seed: If either seed or seed2 are set to non-zero, the random number
  551. generator is seeded by the given seed. Otherwise, it is seeded by a random seed.
  552. *@li seed2: A second seed to avoid seed collision.
  553. *@li min_object_covered: The cropped area of the image must contain at least
  554. this fraction of any bounding box supplied. The value of this parameter should
  555. be non-negative. In the case of 0, the cropped area does not need to overlap
  556. any of the bounding boxes supplied .
  557. *@li aspect_ratio_range: The cropped area of the image must have an aspect
  558. ratio = width / height within this range.
  559. *@li max_attempts: Number of attempts at generating a cropped region of the
  560. image of the specified constraints. After max_attempts failures, return the
  561. entire image.
  562. *@li use_image_if_no_bounding_boxes: Controls behavior if no bounding boxes
  563. supplied. If true, assume an implicit bounding box covering the whole input.
  564. If false, raise an error . \n
  565. *@par Outputs:
  566. *@li begin: 1-D, containing [offset_height, offset_width, 0].
  567. *@li size: 1-D, containing [target_height, target_width, -1].
  568. *@li bboxes: 3-D with shape [1, 1, 4] containing the distorted bounding box . \n
  569. *@attention Constraints:
  570. *Input images can be of different types but output images are always float . \n
  571. *@par Third-party framework compatibility
  572. *Compatible with tensorflow SampleDistortedBoundingBox operator.
  573. */
  574. REG_OP(SampleDistortedBoundingBox)
  575. .INPUT(image_size, TensorType({ DT_UINT8, DT_INT8, DT_INT16, \
  576. DT_INT32, DT_INT64 }))
  577. .INPUT(bounding_boxes, TensorType({ DT_FLOAT }))
  578. .OUTPUT(begin, TensorType({ DT_UINT8, DT_INT8, DT_INT16, \
  579. DT_INT32, DT_INT64 }))
  580. .OUTPUT(size, TensorType({ DT_UINT8, DT_INT8, DT_INT16, \
  581. DT_INT32, DT_INT64 }))
  582. .OUTPUT(bboxes, TensorType({ DT_FLOAT }))
  583. .ATTR(seed, Int, 0)
  584. .ATTR(seed2, Int, 0)
  585. .ATTR(min_object_covered, Float, 0.1f)
  586. .ATTR(aspect_ratio_range, ListFloat, { 0.75f, 1.33f })
  587. .ATTR(area_range, ListFloat, { 0.05f, 1.0f })
  588. .ATTR(max_attempts, Int, 100)
  589. .ATTR(use_image_if_no_bounding_boxes, Bool, false)
  590. .OP_END_FACTORY_REG(SampleDistortedBoundingBox)
  591. /**
  592. *@brief Generate a single randomly distorted bounding box for an image . \n
  593. *@par Inputs:
  594. *Input images must be a 4-D tensor. Inputs include:
  595. *@li image_size: 1-D, containing [height, width, channels].
  596. *@li bounding_boxes: 3-D with shape [batch, N, 4] describing the N bounding
  597. boxes associated with the image.
  598. *@li min_object_covered: The cropped area of the image must contain at least
  599. this fraction of any bounding box supplied. The value of this parameter should
  600. be non-negative. In the case of 0, the cropped area does not need to overlap
  601. any of the bounding boxes supplied . \n
  602. *@par Attributes:
  603. *@li seed: If either seed or seed2 are set to non-zero, the random number
  604. generator is seeded by the given seed. Otherwise, it is seeded by a random seed.
  605. *@li seed2: A second seed to avoid seed collision.
  606. *@li aspect_ratio_range: The cropped area of the image must have an aspect
  607. ratio = width / height within this range.
  608. *@li max_attempts: Number of attempts at generating a cropped region of the
  609. image of the specified constraints. After max_attempts failures, return the
  610. entire image.
  611. *@li use_image_if_no_bounding_boxes: Controls behavior if no bounding boxes
  612. supplied. If true, assume an implicit bounding box covering the whole input.
  613. If false, raise an error . \n
  614. *@par Outputs:
  615. *@li begin: 1-D, containing [offset_height, offset_width, 0].
  616. *@li size: 1-D, containing [target_height, target_width, -1].
  617. *@li bboxes: 3-D with shape [1, 1, 4] containing the distorted bounding box . \n
  618. *@attention Constraints:
  619. *Input images can be of different types but output images are always float . \n
  620. *@par Third-party framework compatibility
  621. *Compatible with tensorflow SampleDistortedBoundingBoxExt2 operator.
  622. */
  623. REG_OP(SampleDistortedBoundingBoxExt2)
  624. .INPUT(image_size, TensorType({ DT_UINT8, DT_INT8, DT_INT16, \
  625. DT_INT32, DT_INT64 }))
  626. .INPUT(bounding_boxes, TensorType({ DT_FLOAT }))
  627. .INPUT(min_object_covered, TensorType({ DT_FLOAT }))
  628. .OUTPUT(begin, TensorType({ DT_UINT8, DT_INT8, DT_INT16, \
  629. DT_INT32, DT_INT64 }))
  630. .OUTPUT(size, TensorType({ DT_UINT8, DT_INT8, DT_INT16, \
  631. DT_INT32, DT_INT64 }))
  632. .OUTPUT(bboxes, TensorType({ DT_FLOAT }))
  633. .ATTR(seed, Int, 0)
  634. .ATTR(seed2, Int, 0)
  635. .ATTR(aspect_ratio_range, ListFloat, { 0.75f, 1.33f })
  636. .ATTR(area_range, ListFloat, { 0.05f, 1.0f })
  637. .ATTR(max_attempts, Int, 100)
  638. .ATTR(use_image_if_no_bounding_boxes, Bool, false)
  639. .OP_END_FACTORY_REG(SampleDistortedBoundingBoxExt2)
  640. /**
  641. *@brief Resize images to size using nearest neighbor interpolation . \n
  642. *@par Inputs:
  643. *Input x must be a 4-D tensor. Inputs include:
  644. *@li x: 4-D tensor. Must set the format, supported format list ["NCHW, NHWC"].
  645. *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width.
  646. The new size for the images . \n
  647. *@par Attributes:
  648. *@li align_corners: If true, the centers of the 4 corner pixels of the input and
  649. output tensors are aligned, preserving the values at the corner pixels.
  650. Defaults to false . \n
  651. *@li half_pixel_centers: An optional bool. Defaults to False . \n
  652. *@par Outputs:
  653. *y: 4-D with shape [batch, new_height, new_width, channels] . \n
  654. *@par Third-party framework compatibility
  655. *Compatible with tensorflow ResizeNearestNeighborV2 operator.
  656. */
  657. REG_OP(ResizeNearestNeighborV2)
  658. .INPUT(x, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32,
  659. DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  660. .INPUT(size, TensorType({DT_INT32}))
  661. .OUTPUT(y, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32,
  662. DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  663. .ATTR(align_corners, Bool, false)
  664. .ATTR(half_pixel_centers, Bool, false)
  665. .OP_END_FACTORY_REG(ResizeNearestNeighborV2)
  666. /**
  667. *@brief Draw bounding boxes on a batch of images . \n
  668. *@par Inputs:
  669. *Input images must be a 4-D tensor. Inputs include:
  670. *@li images: A Tensor. Must be one of the following types: float. 4-D with
  671. shape [batch, height, width, depth]. A batch of images. The format must be NHWC.
  672. *@li boxes: A Tensor of type float32. 3-D with shape [batch,
  673. num_bounding_boxes, 4] containing bounding boxes . \n
  674. *@par Outputs:
  675. *A Tensor. Has the same type as images. The format must be NHWC. \n
  676. *@attention Constraints:
  677. *Input images must be a 4-D tensor . \n
  678. *@par Third-party framework compatibility
  679. *Compatible with tensorflow DrawBoundingBoxes operator.
  680. */
  681. REG_OP(DrawBoundingBoxes)
  682. .INPUT(images, TensorType({DT_FLOAT}))
  683. .INPUT(boxes, TensorType({DT_FLOAT}))
  684. .OUTPUT(y, TensorType({DT_FLOAT}))
  685. .OP_END_FACTORY_REG(DrawBoundingBoxes)
  686. /**
  687. *@brief Greedily selects a subset of bounding boxes in descending order of
  688. score . \n
  689. *@par Inputs:
  690. *Input boxes and scores must be float type. Inputs include:
  691. *@li boxes: A 2-D float tensor of shape [num_boxes, 4].
  692. *@li scores: A 1-D float tensor of shape [num_boxes] representing a single
  693. score corresponding to each box (each row of boxes).
  694. *@li max_output_size: A scalar integer tensor representing the maximum number
  695. of boxes to be selected by non max suppression . \n
  696. *@par Attributes:
  697. *iou_threshold: A float representing the threshold for deciding whether boxes
  698. overlap too much with respect to IOU . \n
  699. *@par Outputs:
  700. *selected_indices: A 1-D integer tensor of shape [M] representing the selected
  701. indices from the boxes tensor, where M <= max_output_size . \n
  702. *@attention Constraints:
  703. *Input boxes and scores must be float type . \n
  704. *@par Third-party framework compatibility
  705. *Compatible with tensorflow NonMaxSuppression operator.
  706. */
  707. REG_OP(NonMaxSuppression)
  708. .INPUT(boxes, TensorType({DT_FLOAT}))
  709. .INPUT(scores, TensorType({DT_FLOAT}))
  710. .INPUT(max_output_size, TensorType({DT_INT32}))
  711. .OUTPUT(selected_indices, TensorType({DT_INT32}))
  712. .ATTR(iou_threshold, Float, 0.5f)
  713. .OP_END_FACTORY_REG(NonMaxSuppression)
  714. /**
  715. *@brief Greedily selects a subset of bounding boxes in descending order of
  716. score . \n
  717. *@par Inputs:
  718. *Input boxes and scores must be float type. Inputs include:
  719. *@li boxes: A 2-D float tensor of shape [num_boxes, 4].
  720. *@li scores: A 1-D float tensor of shape [num_boxes] representing a single
  721. score corresponding to each box (each row of boxes).
  722. *@li max_output_size: A scalar integer tensor representing the maximum number
  723. of boxes to be selected by non max suppression.
  724. *@li iou_threshold: A 0-D float tensor representing the threshold for deciding
  725. whether boxes overlap too much with respect to IOU . \n
  726. *@par Outputs:
  727. *selected_indices: A 1-D integer tensor of shape [M] representing the selected
  728. indices from the boxes tensor, where M <= max_output_size . \n
  729. *@attention Constraints:
  730. *Input boxes and scores must be float type . \n
  731. *@par Third-party framework compatibility
  732. *Compatible with tensorflow NonMaxSuppressionV2 operator.
  733. */
  734. REG_OP(NonMaxSuppressionV2)
  735. .INPUT(boxes, TensorType({DT_FLOAT16, DT_FLOAT}))
  736. .INPUT(scores, TensorType({DT_FLOAT16, DT_FLOAT}))
  737. .INPUT(max_output_size, TensorType({DT_INT32}))
  738. .INPUT(iou_threshold, TensorType({DT_FLOAT16,DT_FLOAT}))
  739. .OUTPUT(selected_indices, TensorType({DT_INT32}))
  740. .OP_END_FACTORY_REG(NonMaxSuppressionV2)
  741. /**
  742. *@brief Greedily selects a subset of bounding boxes in descending order of
  743. score . \n
  744. *@par Inputs:
  745. *Input boxes and scores must be float type. Inputs include:
  746. *@li boxes: A 2-D float tensor of shape [num_boxes, 4].
  747. *@li scores: A 1-D float tensor of shape [num_boxes] representing a single
  748. score corresponding to each box (each row of boxes).
  749. *@li max_output_size: A scalar integer tensor representing the maximum number
  750. of boxes to be selected by non max suppression.
  751. *@li iou_threshold: A 0-D float tensor representing the threshold for deciding
  752. whether boxes overlap too much with respect to IOU.
  753. *@li score_threshold: A 0-D float tensor representing the threshold for
  754. deciding when to remove boxes based on score . \n
  755. *@par Outputs:
  756. *selected_indices: A 1-D integer tensor of shape [M] representing the selected
  757. indices from the boxes tensor, where M <= max_output_size . \n
  758. *@attention Constraints:
  759. *Input boxes and scores must be float type . \n
  760. *@par Third-party framework compatibility
  761. *Compatible with tensorflow NonMaxSuppressionV3 operator.
  762. */
  763. REG_OP(NonMaxSuppressionV3)
  764. .INPUT(boxes, TensorType({DT_FLOAT16, DT_FLOAT}))
  765. .INPUT(scores, TensorType({DT_FLOAT16, DT_FLOAT}))
  766. .INPUT(max_output_size, TensorType({DT_INT32}))
  767. .INPUT(iou_threshold, TensorType({DT_FLOAT16,DT_FLOAT}))
  768. .INPUT(score_threshold, TensorType({DT_FLOAT16,DT_FLOAT}))
  769. .OUTPUT(selected_indices, TensorType({DT_INT32}))
  770. .OP_END_FACTORY_REG(NonMaxSuppressionV3)
  771. /**
  772. *@brief Greedily selects a subset of bounding boxes in descending order of
  773. score . \n
  774. *@par Inputs:
  775. *Input boxes and scores must be float type. Inputs include:
  776. *@li boxes: A 2-D float tensor of shape [num_boxes, 4].
  777. *@li scores: A 1-D float tensor of shape [num_boxes] representing a single
  778. score corresponding to each box (each row of boxes).
  779. *@li max_output_size: A scalar integer tensor representing the maximum number
  780. of boxes to be selected by non max suppression.
  781. *@li iou_threshold: A 0-D float tensor representing the threshold for deciding
  782. whether boxes overlap too much with respect to IOU.
  783. *@li score_threshold: A 0-D float tensor representing the threshold for
  784. deciding when to remove boxes based on score . \n
  785. *@par Attributes:
  786. *pad_to_max_output_size: If true, the output selected_indices is padded
  787. to be of length max_output_size. Defaults to false . \n
  788. *@par Outputs:
  789. *@li selected_indices: A 1-D integer tensor of shape [M] representing the
  790. selected indices from the boxes tensor, where M <= max_output_size.
  791. *@li valid_outputs: A 0-D integer tensor representing the number of valid
  792. elements in selected_indices, with the valid elements appearing first . \n
  793. *@attention Constraints:
  794. *Input boxes and scores must be float type . \n
  795. *@par Third-party framework compatibility
  796. *Compatible with tensorflow NonMaxSuppressionV4 operator.
  797. */
  798. REG_OP(NonMaxSuppressionV4)
  799. .INPUT(boxes, TensorType({DT_FLOAT16, DT_FLOAT}))
  800. .INPUT(scores, TensorType({DT_FLOAT16, DT_FLOAT}))
  801. .INPUT(max_output_size, TensorType({DT_INT32}))
  802. .INPUT(iou_threshold, TensorType({DT_FLOAT16,DT_FLOAT}))
  803. .INPUT(score_threshold, TensorType({DT_FLOAT16,DT_FLOAT}))
  804. .OUTPUT(selected_indices, TensorType({DT_INT32}))
  805. .OUTPUT(valid_outputs, TensorType({DT_INT32}))
  806. .ATTR(pad_to_max_output_size, Bool, false)
  807. .OP_END_FACTORY_REG(NonMaxSuppressionV4)
  808. /**
  809. *@brief Greedily selects a subset of bounding boxes in descending order of
  810. score . \n
  811. *@par Inputs:
  812. *Input overlaps and scores must be float type. Inputs include:
  813. *@li overlaps: A 2-D float tensor of shape [num_boxes, num_boxes]
  814. representing the n-by-n box overlap values.
  815. *@li scores: A 1-D float tensor of shape [num_boxes] representing a single
  816. score corresponding to each box (each row of boxes).
  817. *@li max_output_size: A scalar integer tensor representing the maximum number
  818. of boxes to be selected by non max suppression.
  819. *@li overlap_threshold: A 0-D float tensor representing the threshold for
  820. deciding whether boxes overlap too.
  821. *@li score_threshold: A 0-D float tensor representing the threshold for
  822. deciding when to remove boxes based on score . \n
  823. *@par Attributes:
  824. *pad_to_max_output_size: If true, the output selected_indices is padded
  825. to be of length max_output_size. Defaults to false . \n
  826. *@par Outputs:
  827. *selected_indices: A 1-D integer tensor of shape [M] representing the
  828. selected indices from the boxes tensor, where M <= max_output_size . \n
  829. *@par Third-party framework compatibility
  830. *Compatible with tensorflow NonMaxSuppressionWithOverlaps operator.
  831. */
  832. REG_OP(NonMaxSuppressionWithOverlaps)
  833. .INPUT(overlaps, TensorType({DT_FLOAT}))
  834. .INPUT(scores, TensorType({DT_FLOAT}))
  835. .INPUT(max_output_size, TensorType({DT_INT32}))
  836. .INPUT(overlap_threshold, TensorType({DT_FLOAT}))
  837. .INPUT(score_threshold, TensorType({DT_FLOAT}))
  838. .OUTPUT(selected_indices, TensorType({DT_INT32}))
  839. .OP_END_FACTORY_REG(NonMaxSuppressionWithOverlaps)
  840. /**
  841. *@brief JPEG-encode an image . \n
  842. *@par Inputs:
  843. *Input image must be unit8 type. Inputs include:
  844. *image: A 3-D uint8 Tensor of shape [height, width, channels] . \n
  845. *@par Attributes:
  846. *@li format: Per pixel image format.
  847. *@li quality: Quality of the compression from 0 to 100 (higher is better
  848. and slower).
  849. *@li progressive: If True, create a JPEG that loads progressively (coarse
  850. to fine).
  851. *@li optimize_size: If True, spend CPU/RAM to reduce size with no quality
  852. change.
  853. *@li chroma_downsampling: A boolean, default is true.
  854. *@li density_unit: Unit used to specify x_density and y_density: pixels per
  855. inch ('in') or centimeter ('cm').
  856. *@li x_density: Horizontal pixels per density unit.
  857. *@li y_density: Vertical pixels per density unit.
  858. *@li xmp_metadata: If not empty, embed this XMP metadata in the image header . \n
  859. *@par Outputs:
  860. *contents: 0-D. JPEG-encoded image . \n
  861. *@par Third-party framework compatibility
  862. *Compatible with tensorflow EncodeJpeg operator.
  863. */
  864. REG_OP(EncodeJpeg)
  865. .INPUT(image, TensorType({DT_UINT8}))
  866. .OUTPUT(contents, TensorType({DT_STRING}))
  867. .ATTR(format, String, "")
  868. .ATTR(quality, Int, 95)
  869. .ATTR(progressive, Bool, false)
  870. .ATTR(optimize_size, Bool, false)
  871. .ATTR(chroma_downsampling, Bool, true)
  872. .ATTR(density_unit, String, "in")
  873. .ATTR(x_density, Int, 300)
  874. .ATTR(y_density, Int, 300)
  875. .ATTR(xmp_metadata, String, "")
  876. .OP_END_FACTORY_REG(EncodeJpeg)
  877. /**
  878. *@brief PNG-encode an image.
  879. *@par Inputs:
  880. *Input image must be unit8 or uint16 type. Inputs include:
  881. *image: is a 3-D uint8 or uint16 Tensor of shape [height, width, channels]
  882. where channels is: 1: for grayscale; 2: for grayscale + alpha; 3: for RGB;
  883. 4: for RGBA . \n
  884. *@par Attributes:
  885. *compression: Compression level . \n
  886. *@par Outputs:
  887. *contents: 0-D. PNG-encoded image . \n
  888. *@par Third-party framework compatibility
  889. *Compatible with tensorflow EncodePng operator.
  890. */
  891. REG_OP(EncodePng)
  892. .INPUT(image, TensorType({DT_UINT8, DT_UINT16}))
  893. .OUTPUT(contents, TensorType({DT_STRING}))
  894. .ATTR(compression, Int, -1)
  895. .OP_END_FACTORY_REG(EncodePng)
  896. /**
  897. *@brief PNG-decode an image.
  898. *@par Inputs:
  899. *contents: 0-D. PNG-decoded image .
  900. *@par Attributes:
  901. *channels: graph channels \n
  902. *dtype: type of image
  903. *@par Outputs:
  904. *image: is a 3-D uint8 or uint16 Tensor of shape [height, width, channels]
  905. where channels is: 1: for grayscale; 2: for grayscale + alpha; 3: for RGB;
  906. 4: for RGBA . \n
  907. *@par Third-party framework compatibility
  908. *Compatible with tensorflow DecodePng operator.
  909. */
  910. REG_OP(DecodePng)
  911. .INPUT(contents, TensorType({DT_STRING}))
  912. .OUTPUT(image, TensorType({DT_UINT8, DT_UINT16}))
  913. .ATTR(dtype, Type, DT_UINT8)
  914. .ATTR(channels, Int, 0)
  915. .OP_END_FACTORY_REG(DecodePng)
  916. /**
  917. *@brief Bmp-decode an image. \n
  918. *@par Inputs:
  919. *@li contents: A Tensor of type string. 0-D. The BMP-encoded image. \n
  920. *@par Attributes:
  921. *@li channels: Decode the desired number of color channels of the image. \n
  922. *@par Outputs:
  923. *image: A Tensor dtype of uint8.
  924. * @par Third-party framework compatibility
  925. * Compatible with tensorflow DecodeBmp operator.
  926. */
  927. REG_OP(DecodeBmp)
  928. .INPUT(contents, TensorType({DT_STRING}))
  929. .OUTPUT(image, TensorType({DT_UINT8}))
  930. .ATTR(channels, Int, 0)
  931. .OP_END_FACTORY_REG(DecodeBmp)
  932. /**
  933. *@brief Function parse image from string to int. \n
  934. *@par Inputs:
  935. *@li contents: A Tensor of type string. 0-D. The JPEG-encoded image. \n
  936. *@li crop_window: 1-D. The crop window: [crop_y, crop_x, crop_height, crop_width]. \n
  937. *@par Attributes:
  938. *@li channels: An optional int. Defaults to 0. Number of color channels for the
  939. *decoded image.
  940. *@li ratio: An optional int. Defaults to 1. Downscaling ratio.
  941. *@li fancy_upscaling: An optional bool. Defaults to True. If true use a slower
  942. *but nicer upscaling of the chroma planes
  943. *@li try_recover_truncated: An optional bool. Defaults to False. If true try to
  944. *recover an image from truncated input.
  945. *@li acceptable_fraction: An optional float. Defaults to 1. The minimum required
  946. fraction of lines before a truncated input is accepted.
  947. *@li dct_method: An optional string. Defaults to "". string specifying a hint
  948. *about the algorithm used for decompression. \n
  949. *@par Outputs:
  950. *image: A Tensor dtype of uint8.
  951. */
  952. REG_OP(DecodeAndCropJpeg)
  953. .INPUT(contents, TensorType({DT_STRING}))
  954. .INPUT(crop_window, TensorType({DT_INT32}))
  955. .OUTPUT(image, TensorType({DT_UINT8}))
  956. .ATTR(channels, Int, 0)
  957. .ATTR(ratio, Int, 1)
  958. .ATTR(fancy_upscaling, Bool, true)
  959. .ATTR(try_recover_truncated, Bool, false)
  960. .ATTR(acceptable_fraction, Float, 1.0)
  961. .ATTR(dct_method, String, "")
  962. .OP_END_FACTORY_REG(DecodeAndCropJpeg)
  963. /**
  964. *@brief Resizes "images" to "size" using bilinear interpolation . \n
  965. *@par Inputs:
  966. * One input:
  967. *x: An NC1HWC0 Tensor.
  968. * Must be one of the following types: float16, float32 . \n
  969. *@par Attributes:
  970. *@li size: A required int32 Tensor specifying the new size for the images.
  971. No default value.
  972. *@li align_corners: An optional bool. If "true", the centers of the corner
  973. pixels of the input and output tensors are aligned. Defaults to "false" . \n
  974. *@par Outputs:
  975. *y: A Tensor with type float32 and the same format as input "images" . \n
  976. *@attention Constraints:
  977. *@li The input "size" must be a tensor of 2 elements: size[0] <= 2048,
  978. size[1] <= 2048.
  979. *@li The input "images" must be a tensor of 5 elements: images[2] <= 2048,
  980. images[3] <= 2048 . \n
  981. *@par Third-party framework compatibility
  982. * Compatible with TensorFlow operator ResizeBilinearV2D.
  983. *
  984. * @par Restrictions:
  985. * Warning: THIS FUNCTION IS DEPRECATED. Please use ResizeBilinearV2 instead.
  986. */
  987. REG_OP(ResizeBilinearV2D)
  988. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
  989. .OUTPUT(y, TensorType({DT_FLOAT}))
  990. .ATTR(align_corners, Bool, false)
  991. .ATTR(half_pixel_centers, Bool, false)
  992. .REQUIRED_ATTR(size, ListInt)
  993. .OP_END_FACTORY_REG(ResizeBilinearV2D)
  994. /**
  995. *@brief Resizes "images" to "size" using bilinear interpolation and keep ratio at the time. \n
  996. *@par Inputs:
  997. * One input:
  998. *images: An NC1HWC0 Tensor.
  999. * Must be one of the following types: float16, float32 . \n
  1000. *@par Attributes:
  1001. *@li min_dimension: A required int32 attribute for the min dimension for the images.
  1002. * No default value.
  1003. *@li max_dimension: A required int32 attribute for the max dimension for the images.
  1004. * No default value.
  1005. *@li align_corners: An optional bool. If "true", the centers of the corner
  1006. * pixels of the input and output tensors are aligned. Defaults to "false".
  1007. *@li half_pixel_centers: indicates if the offset coordinates are normalized
  1008. * Defaults to "false" . \n
  1009. *@par Outputs:
  1010. *y: A Tensor with type float32 and the same format as input "images" . \n
  1011. *@attention Constraints:
  1012. * The input "images" must be a tensor of 5 elements: images[2] <= 2048,
  1013. images[3] <= 2048.
  1014. */
  1015. REG_OP(KeepRatioResizeBilinear)
  1016. .INPUT(images, TensorType({DT_FLOAT16, DT_FLOAT}))
  1017. .OUTPUT(y, TensorType({DT_FLOAT}))
  1018. .REQUIRED_ATTR(min_dimension, Int)
  1019. .REQUIRED_ATTR(max_dimension, Int)
  1020. .ATTR(align_corners, Bool, false)
  1021. .ATTR(half_pixel_centers, Bool, false)
  1022. .OP_END_FACTORY_REG(KeepRatioResizeBilinear)
  1023. /**
  1024. *@brief Resizes "images" to "size" using nearest neighbor interpolation . \n
  1025. *@par Inputs:
  1026. * One input:
  1027. *x: An NC1HWC0 Tensor.
  1028. * Must be one of the following types: float16, float32, int32, int8, uint8
  1029. *@par Attributes:
  1030. *@li size: A required int32 Tensor specifying the new size for the images.
  1031. No default value.
  1032. *@li align_corners: An optional bool. If "true", the centers of the corner
  1033. pixels of the input and output tensors are aligned. Defaults to "false" . \n
  1034. *@li half_pixel_centers: An optional bool. Defaults to False . \n
  1035. *@par Outputs:
  1036. *y: A Tensor with the same type and format as input "images" . \n
  1037. *@attention Constraints:
  1038. * The input "size" must be a tensor of 2 elements: size[0] <= 7680,
  1039. size[1] <= 4320
  1040. *@par Third-party framework compatibility
  1041. * Compatible with TensorFlow operator ResizeNearestNeighborV2.
  1042. *
  1043. * @par Restrictions:
  1044. * Warning: THIS FUNCTION IS DEPRECATED. Please use ResizeNearestNeighborV2 instead.
  1045. */
  1046. REG_OP(ResizeNearestNeighborV2D)
  1047. .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  1048. .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  1049. .REQUIRED_ATTR(size, ListInt)
  1050. .ATTR(align_corners, Bool, false)
  1051. .ATTR(half_pixel_centers, Bool, false)
  1052. .OP_END_FACTORY_REG(ResizeNearestNeighborV2D)
  1053. /**
  1054. *@brief Extract the shape information of a JPEG-encoded image . \n
  1055. *@par Inputs:
  1056. *Input contents must be 0-D. Inputs include:
  1057. *contents: 0-D. The JPEG-encoded image . \n
  1058. *@par Attributes:
  1059. *output_type: The output type of the operation (int32 or int64). Defaults
  1060. to int32 . \n
  1061. *@par Outputs:
  1062. *image_shape: 1-D. The image shape with format [height, width, channels] . \n
  1063. *@par Third-party framework compatibility
  1064. *Compatible with tensorflow ExtractJpegShape operator.
  1065. */
  1066. REG_OP(ExtractJpegShape)
  1067. .INPUT(contents, TensorType({DT_STRING}))
  1068. .OUTPUT(image_shape, TensorType({DT_INT32, DT_INT64}))
  1069. .REQUIRED_ATTR(output_type, Type)
  1070. .OP_END_FACTORY_REG(ExtractJpegShape)
  1071. /**
  1072. *@brief Draw bounding boxes on a batch of images . \n
  1073. *@par Inputs:
  1074. *@li images: 4-D with shape `[batch, height, width, depth]`.
  1075. A batch of images.
  1076. *@li boxes: 3-D with shape `[batch, num_bounding_boxes, 4]`
  1077. containing bounding boxes.
  1078. *@li colors: 2-D. A list of RGBA colors to cycle through for the boxes . \n
  1079. *@par Outputs:
  1080. *y: Returns 4-D with the same shape as `images`.
  1081. The batch of input images with bounding boxes drawn on the images . \n
  1082. *@par Third-party framework compatibility
  1083. * Compatible with tensorflow DrawBoundingBoxesV2 operator.
  1084. */
  1085. REG_OP(DrawBoundingBoxesV2)
  1086. .INPUT(images, TensorType({DT_FLOAT}))
  1087. .INPUT(boxes, TensorType({DT_FLOAT}))
  1088. .INPUT(colors, TensorType({DT_FLOAT}))
  1089. .OUTPUT(y, TensorType({DT_FLOAT}))
  1090. .OP_END_FACTORY_REG(DrawBoundingBoxesV2)
  1091. /**
  1092. *@brief Greedily selects a subset of bounding boxes in descending order of score,
  1093. pruning away boxes that have high intersection-over-union (IOU) overlap
  1094. with previously selected boxes . \n
  1095. *@par Inputs:
  1096. *@li boxes: A 2-D float tensor of shape `[num_boxes, 4]`.
  1097. *@li scores: A 1-D float tensor of shape `[num_boxes]` representing a single
  1098. score corresponding to each box (each row of boxes).
  1099. *@li max_output_size: A scalar integer tensor representing the maximum number of
  1100. boxes to be selected by non max suppression.
  1101. *@li iou_threshold: A 0-D float tensor representing the threshold for deciding whether
  1102. boxes overlap too much with respect to IOU.
  1103. *@li score_threshold: A 0-D float tensor representing the threshold for deciding when to
  1104. remove boxes based on score.
  1105. *@li soft_nms_sigma: A 0-D float tensor representing the sigma parameter for Soft NMS . \n
  1106. *@par Attributes:
  1107. pad_to_max_output_size: If true, the output `selected_indices` is padded to be of length
  1108. `max_output_size`. Defaults to false. If not specified, defaults to false . \n
  1109. *@par Outputs:
  1110. *@li selected_indices: A 1-D integer tensor of shape [M] representing the
  1111. selected indices from the boxes tensor, where M <= max_output_size.
  1112. *@li selected_scores: A 1-D float tensor of shape `[M]` representing the corresponding
  1113. scores for each selected box, where `M <= max_output_size`.
  1114. *@li valid_outputs: A 0-D integer tensor representing the number of valid
  1115. elements in selected_indices, with the valid elements appearing first . \n
  1116. *@par Third-party framework compatibility
  1117. * Compatible with tensorflow NonMaxSuppressionV5 operator.
  1118. */
  1119. REG_OP(NonMaxSuppressionV5)
  1120. .INPUT(boxes, TensorType({DT_FLOAT16, DT_FLOAT}))
  1121. .INPUT(scores, TensorType({DT_FLOAT16, DT_FLOAT}))
  1122. .INPUT(max_output_size, TensorType({DT_INT32}))
  1123. .INPUT(iou_threshold, TensorType({DT_FLOAT16, DT_FLOAT}))
  1124. .INPUT(score_threshold, TensorType({DT_FLOAT16, DT_FLOAT}))
  1125. .INPUT(soft_nms_sigma, TensorType({DT_FLOAT16, DT_FLOAT}))
  1126. .OUTPUT(selected_indices, TensorType({DT_INT32}))
  1127. .OUTPUT(selected_scores, TensorType({DT_FLOAT16, DT_FLOAT}))
  1128. .OUTPUT(valid_outputs, TensorType({DT_INT32}))
  1129. .ATTR(pad_to_max_output_size, Bool, false)
  1130. .REQUIRED_ATTR(T, Type)
  1131. .OP_END_FACTORY_REG(NonMaxSuppressionV5)
  1132. /**
  1133. *@brief Resizes "images" to "size" by scale and translate . \n
  1134. *@par Inputs:
  1135. *@li images: A `Tensor`. Must be one of the following types: `int8`, `uint8`,
  1136. `int16`, `uint16`, `int32`, `int64`, `bfloat16`, `float32`, `float64`.
  1137. *@li size: A `Tensor` of type `int32`.
  1138. *@li scale: A `Tensor` of type `float32`.
  1139. *@li translation: A `Tensor` of type `float32` . \n
  1140. *@li kernel_type: type is string, default lanczos3
  1141. *@li antialias: type is bool, default true \n
  1142. *@par Outputs:
  1143. *y: A Tensor with type float32 . \n
  1144. *@par Third-party framework compatibility
  1145. * Compatible with TensorFlow ScaleAndTranslate operator.
  1146. */
  1147. REG_OP(ScaleAndTranslate)
  1148. .INPUT(images, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16,
  1149. DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  1150. .INPUT(size, TensorType({DT_INT32}))
  1151. .INPUT(scale, TensorType({DT_FLOAT}))
  1152. .INPUT(translation, TensorType({DT_FLOAT}))
  1153. .OUTPUT(y, TensorType({DT_FLOAT}))
  1154. .ATTR(kernel_type, String, "lanczos3")
  1155. .ATTR(antialias, Bool, true)
  1156. .OP_END_FACTORY_REG(ScaleAndTranslate)
  1157. /**
  1158. *@brief Computes the gradient by scale and translate . \n
  1159. *@par Inputs:
  1160. *@li grads: A `Tensor`. Must be one of the following types: `float32`.
  1161. *@li original_image: A `Tensor`. Must have the same type as `grads`.
  1162. *@li scale: A `Tensor` of type `float32`.
  1163. *@li translation: A `Tensor` of type `float32` . \n
  1164. *@li kernel_type: type is string, default lanczos3
  1165. *@li antialias: type is bool, default true
  1166. *@par Outputs:
  1167. *y: A `Tensor`. Has the same type as `grads` . \n
  1168. *@par Third-party framework compatibility
  1169. * Compatible with TensorFlow ScaleAndTranslateGrad operator.
  1170. */
  1171. REG_OP(ScaleAndTranslateGrad)
  1172. .INPUT(grads, TensorType({DT_FLOAT}))
  1173. .INPUT(original_image, TensorType({DT_FLOAT}))
  1174. .INPUT(scale, TensorType({DT_FLOAT}))
  1175. .INPUT(translation, TensorType({DT_FLOAT}))
  1176. .OUTPUT(y, TensorType({DT_FLOAT}))
  1177. .ATTR(kernel_type, String, "lanczos3")
  1178. .ATTR(antialias, Bool, true)
  1179. .OP_END_FACTORY_REG(ScaleAndTranslateGrad)
  1180. /**
  1181. *@brief Greedily selects a subset of bounding boxes in descending order of score,
  1182. This operation performs non_max_suppression on the inputs per batch, across all classes . \n
  1183. *@par Inputs:
  1184. *@li boxes: A 4-D float tensor of shape `[batch_size, num_boxes, q, 4]`. If `q` is 1 then
  1185. same boxes are used for all classes otherwise, if `q` is equal to number of
  1186. classes, class-specific boxes are used.
  1187. *@li scores: A 3-D float tensor of shape `[batch_size, num_boxes, num_classes]`
  1188. representing a single score corresponding to each box (each row of boxes).
  1189. *@li max_output_size_per_class: A scalar integer tensor representing the maximum number of
  1190. boxes to be selected by non max suppression per class.
  1191. *@li max_total_size: A scalar representing maximum number of boxes retained over all classes.
  1192. *@li iou_threshold: A 0-D float tensor representing the threshold for deciding whether
  1193. boxes overlap too much with respect to IOU.
  1194. *@li score_threshold: A 0-D float tensor representing the threshold for deciding when to remove
  1195. boxes based on score . \n
  1196. *@par Attributes:
  1197. *@li pad_per_class: If false, the output nmsed boxes, scores and classes
  1198. are padded/clipped to `max_total_size`. If true, the
  1199. output nmsed boxes, scores and classes are padded to be of length
  1200. `max_size_per_class`*`num_classes`, unless it exceeds `max_total_size` in
  1201. which case it is clipped to `max_total_size`. Defaults to false.
  1202. *@li clip_boxes: If true, assume the box coordinates are between [0, 1] and clip the output boxes
  1203. if they fall beyond [0, 1]. If false, do not do clipping and output the box
  1204. coordinates as it is. If not specified, defaults to true . \n
  1205. *@par Outputs:
  1206. *nmsed_boxes:type is float
  1207. *nmsed_scores:type is float
  1208. *nmsed_classes:type is float \n
  1209. *@par Third-party framework compatibility
  1210. * Compatible with tensorflow CombinedNonMaxSuppression operator.
  1211. */
  1212. REG_OP(CombinedNonMaxSuppression)
  1213. .INPUT(boxes, TensorType({DT_FLOAT}))
  1214. .INPUT(scores, TensorType({DT_FLOAT}))
  1215. .INPUT(max_output_size_per_class, TensorType({DT_INT32}))
  1216. .INPUT(max_total_size, TensorType({DT_INT32}))
  1217. .INPUT(iou_threshold, TensorType({DT_FLOAT}))
  1218. .INPUT(score_threshold, TensorType({DT_FLOAT}))
  1219. .OUTPUT(nmsed_boxes, TensorType({DT_FLOAT}))
  1220. .OUTPUT(nmsed_scores, TensorType({DT_FLOAT}))
  1221. .OUTPUT(nmsed_classes, TensorType({DT_FLOAT}))
  1222. .OUTPUT(valid_detections, TensorType({DT_INT32}))
  1223. .ATTR(pad_per_class, Bool, false)
  1224. .ATTR(clip_boxes, Bool, true)
  1225. .OP_END_FACTORY_REG(CombinedNonMaxSuppression)
  1226. /**
  1227. *@brief Resizes "images" with "offset" using bilinear interpolation. \n
  1228. *@par Inputs:
  1229. *@li img: input image, A 4-D tensor of shape `[n, h, w, c]`.
  1230. *@li warp_offset: the resize offset A 4-D float tensor of shape `[n, h, w, 2]`, 2 means (x, y) for offset point.
  1231. *@par Outputs:
  1232. *warp_img: A Tensor after resize. \n
  1233. */
  1234. REG_OP(IMGWarp)
  1235. .INPUT(img, TensorType({DT_UINT8, DT_FLOAT16, DT_FLOAT32}))
  1236. .INPUT(warp_offset, TensorType({DT_FLOAT32}))
  1237. .OUTPUT(warp_img, TensorType({DT_UINT8, DT_FLOAT16, DT_FLOAT32}))
  1238. .OP_END_FACTORY_REG(IMGWarp)
  1239. /**
  1240. *@brief Resizes "images" with "offset" using bilinear interpolation. \n
  1241. *@par Inputs:
  1242. *@li img: input image, A 4-D tensor of shape `[n, h, w, c]`.
  1243. *@li map_offset: the resize offset A 4-D float tensor of shape `[n, h, w, 2]`, 2 means (x, y) for resize point.
  1244. *@par Outputs:
  1245. *map_img: A Tensor after resize. \n
  1246. */
  1247. REG_OP(Remap)
  1248. .INPUT(img, TensorType({DT_UINT8, DT_FLOAT16, DT_FLOAT32}))
  1249. .INPUT(map_offset, TensorType({DT_FLOAT32}))
  1250. .OUTPUT(map_img, TensorType({DT_UINT8, DT_FLOAT16, DT_FLOAT32}))
  1251. .OP_END_FACTORY_REG(Remap)
  1252. /**
  1253. *@brief Resizes "images" with "offset" using bilinear interpolation. \n
  1254. *@par Inputs:
  1255. *@li img: input image, A 5-D tensor of shape `[n, 4, c, h, w]`,
  1256. and 4 mean input[(h_top, w_left), (h_top, w_right), (h_bottom, w_left), (h_bottom, w_right)].
  1257. *@li warp_index: the resize offset A 4-D float tensor of shape `[n, 2, h, w]`, 2 means (x, y) for resize point.
  1258. *@par Outputs:
  1259. *remap_img: A Tensor after ResizeBilinear, A 4-D tensor of shape `[n, c, h, w]`. \n
  1260. */
  1261. REG_OP(IMGWarpResize)
  1262. .INPUT(img, TensorType({DT_FLOAT32}))
  1263. .INPUT(warp_index, TensorType({DT_FLOAT32}))
  1264. .OUTPUT(warp_img, TensorType({DT_FLOAT32}))
  1265. .OP_END_FACTORY_REG(IMGWarpResize)
  1266. /**
  1267. *@brief Function spatial transformer . \n
  1268. *@par Inputs:
  1269. *@li x: A Tensor dtype of float16, float32.
  1270. *@li theta: A Tensor dtype of float16, float32, auxiliary coefficients . \n
  1271. *@par Attributes:
  1272. *@li output_size: A tuple output size.
  1273. *@li default_theta: A tuple default theta
  1274. *@li use_default_theta: List use default theta
  1275. *@li align_corners: Align corners
  1276. *@par Outputs:
  1277. *y: A Tensor dtype of float16, float32, should be same shape and type as x.
  1278. */
  1279. REG_OP(SpatialTransformerD)
  1280. .INPUT(x, TensorType({DT_FLOAT,DT_FLOAT16}))
  1281. .OPTIONAL_INPUT(theta, TensorType({DT_FLOAT,DT_FLOAT16}))
  1282. .OUTPUT(y, TensorType({DT_FLOAT,DT_FLOAT16}))
  1283. .ATTR(output_size, ListInt, {-1, -1})
  1284. .ATTR(default_theta, ListFloat, {})
  1285. .ATTR(align_corners, Bool, false)
  1286. .ATTR(use_default_theta, ListBool, {})
  1287. .OP_END_FACTORY_REG(SpatialTransformerD)
  1288. /**
  1289. * @brief Resize the input tensor. \n
  1290. currently, only support resize image tensor using nearest neighbor and linear interpolation.
  1291. * @par Inputs:
  1292. * Input x must be a 4-D tensor. Inputs include: \n
  1293. * @li x: A Tensor. Must be one of the following types: uint8, int8, int16, \n
  1294. int32, int64, float16, float, double. 4-D with shape [batch, height, width, channels] \n
  1295. or shape [batch, channels, height, width].
  1296. * @li roi: A 1-D float Tensor. only takes effect when attr coordinate_transformation_mode \n
  1297. is "tf_crop_and_resize"
  1298. * @li scales: A 1-D float Tensor, the scale array along each dimension, Only one of \n
  1299. 'scales' and 'sizes' can be specified.
  1300. * @li sizes: A 1-D int64 Tensor, The size of the output tensor. nly one of \n
  1301. 'scales' and 'sizes' can be specified. If 'size' is specified, then set scales \n
  1302. to empty data (zero shape) in this operator's input list.
  1303. * @par Attributes:
  1304. * @li coordinate_transformation_mode: String. Defaults to half_pixel. how to transform \n
  1305. the coordinate in the resized tensor to the coordinate in the original tensor. \n
  1306. other optional: pytorch_half_pixel, align_corners, asymmetric, tf_half_pixel_for_nn, \n
  1307. tf_crop_and_resize.
  1308. * @li cubic_coeff_a: Float. Defaults to -0.75, only used in cubic interpolation. \n
  1309. other optional: -0.5
  1310. * @li exclude_outside: Int. Defaults to 0, If set to 1, the weight of sampling \n
  1311. locations outside the tensor will be set to 0 and the weight will be renormalized \n
  1312. so that their sum is 1.0.
  1313. * @li extrapolation_value: Float. Defaults to 0.0f. When coordinate_transformation_mode \n
  1314. is "tf_crop_and_resize" and x_original is outside the range [0, length_original - 1], \n
  1315. this value is used as the corresponding output value.
  1316. * @li mode: String. Defaults to nearest. Three interpolation modes: nearest (default), \n
  1317. linear and cubic.
  1318. * @li nearest_mode: String. Defaults to round_prefer_floor. Four modes: round_prefer_floor, \n
  1319. round_prefer_ceil, floor, ceil. Only used by nearest interpolation.
  1320. * @par Outputs:
  1321. * y: A Tensor. Has the same type as x.
  1322. * @attention Constraints: \n
  1323. * Input x must be a 4-D tensor.
  1324. * @par Third-party framework compatibility
  1325. * Compatible with tensorflow ResizeNearestNeighborV2 operator.
  1326. */
  1327. REG_OP(Resize)
  1328. .INPUT(x, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32,
  1329. DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  1330. .INPUT(roi, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  1331. .INPUT(scales, TensorType({DT_FLOAT}))
  1332. .OPTIONAL_INPUT(sizes, TensorType({DT_INT64}))
  1333. .OUTPUT(y, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32,
  1334. DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  1335. .ATTR(coordinate_transformation_mode, String, "half_pixel")
  1336. .ATTR(cubic_coeff_a, Float, -0.75)
  1337. .ATTR(exclude_outside, Int, 0)
  1338. .ATTR(extrapolation_value, Float, 0)
  1339. .ATTR(mode, String, "nearest")
  1340. .ATTR(nearest_mode, String, "round_prefer_floor")
  1341. .OP_END_FACTORY_REG(Resize)
  1342. /**
  1343. *@brief Function parse image from string to int. \n
  1344. *@par Inputs:
  1345. *@li contents: A Tensor of type string. 0-D. The JPEG-encoded image. \n
  1346. *@par Attributes:
  1347. *@li channels: An optional int. Defaults to 0. Number of color channels for the decoded image.
  1348. *@li ratio: An optional int. Defaults to 1. Downscaling ratio.
  1349. *@li fancy_upscaling: An optional bool. Defaults to True. If true use a slower but nicer upscaling of the chroma planes
  1350. *@li try_recover_truncated: An optional bool. Defaults to False. If true try to recover an image from truncated input.
  1351. *@li acceptable_fraction: An optional float. Defaults to 1. The minimum required fraction of lines before a truncated input is accepted.
  1352. *@li dct_method: An optional string. Defaults to "". string specifying a hint about the algorithm used for decompression. \n
  1353. *@par Outputs:
  1354. *image: A Tensor dtype of uint8.
  1355. */
  1356. REG_OP(DecodeJpeg)
  1357. .INPUT(contents, TensorType({DT_STRING}))
  1358. .OUTPUT(image, TensorType({DT_UINT8}))
  1359. .ATTR(channels, Int, 0)
  1360. .ATTR(ratio, Int, 1)
  1361. .ATTR(fancy_upscaling, Bool, true)
  1362. .ATTR(try_recover_truncated, Bool, false)
  1363. .ATTR(acceptable_fraction, Float, 1.0)
  1364. .ATTR(dct_method, String, "")
  1365. .OP_END_FACTORY_REG(DecodeJpeg)
  1366. /**
  1367. *@brief Image warping using per-pixel flow vectors. \n
  1368. *@par Inputs:
  1369. *@li image: 4-D Tensor with shape `[batch, height, width, channels]`.
  1370. *@li flow: 4-D Tensor with shape `[batch, height, width, 2]`. \n
  1371. *@par Outputs:
  1372. *y: Returns 4-D with the same shape and dtype as `image`. \n
  1373. */
  1374. REG_OP(DenseImageWarp)
  1375. .INPUT(image, TensorType({DT_FLOAT, DT_FLOAT16}))
  1376. .INPUT(flow, TensorType({DT_FLOAT, DT_FLOAT16}))
  1377. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16}))
  1378. .OP_END_FACTORY_REG(DenseImageWarp)
  1379. /**
  1380. *@brief Calculate the resize_d function. \n
  1381. *@par Inputs:
  1382. *One inputs, including:
  1383. * @li x: A tensor. Must be one of the following types:
  1384. * float16, float32. \n
  1385. *@par Attributes:
  1386. *@li sizes: An optional listInt. \n
  1387. *@li scales: An optional listFloat.
  1388. Defaults to none. \n
  1389. *@li roi: An optional listInt.
  1390. Defaults to none. \n
  1391. *@li coordinate_transformation_mode: An optional String.
  1392. Defaults to "half_pixel". \n
  1393. *@li cubic_coeff_a: An optional float.
  1394. Defaults to -0.75. \n
  1395. *@li exclude_outside: An optional int.
  1396. Defaults to 0. \n
  1397. *@li extrapolation_value: An optional float.
  1398. Defaults to 0.0. \n
  1399. *@li mode: An optional String.
  1400. Defaults to "nearest". \n
  1401. *@li nearest_mode: An optional String.
  1402. Defaults to "round_prefer_floor". \n
  1403. *@par Outputs:
  1404. *y: A Tensor with the same type of x's,
  1405. shape depends on x and sizes. \n
  1406. */
  1407. REG_OP(ResizeD)
  1408. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
  1409. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT}))
  1410. .REQUIRED_ATTR(sizes, ListInt)
  1411. .ATTR(scales, ListFloat, {})
  1412. .ATTR(roi, ListInt, {})
  1413. .ATTR(coordinate_transformation_mode, String, "half_pixel")
  1414. .ATTR(cubic_coeff_a, Float, -0.75)
  1415. .ATTR(exclude_outside, Int, 0)
  1416. .ATTR(extrapolation_value, Float, 0.0)
  1417. .ATTR(mode, String, "nearest")
  1418. .ATTR(nearest_mode, String, "round_prefer_floor")
  1419. .OP_END_FACTORY_REG(ResizeD)
  1420. /**
  1421. *@brief Calculate the resize_grad_d function. \n
  1422. *@par Inputs:
  1423. *One inputs, including:
  1424. * @li grads: A tensor. Must be one of the following types:
  1425. * float16, float32. \n
  1426. *@par Attributes:
  1427. *@li original_size: An optional listInt. \n
  1428. *@li roi: An optional listInt.
  1429. Defaults to none. \n
  1430. *@li scales: An optional listFloat.
  1431. Defaults to none. \n
  1432. *@li coordinate_transformation_mode: An optional String.
  1433. Defaults to "half_pixel". \n
  1434. *@li cubic_coeff_a: An optional float.
  1435. Defaults to -0.75. \n
  1436. *@li exclude_outside: An optional int.
  1437. Defaults to 0. \n
  1438. *@li extrapolation_value: An optional float.
  1439. Defaults to 0.0. \n
  1440. *@li mode: An optional String.
  1441. Defaults to "nearest". \n
  1442. *@li nearest_mode: An optional String.
  1443. Defaults to "round_prefer_floor". \n
  1444. *@par Outputs:
  1445. *y: A Tensor with the same type of x's,
  1446. shape depends on x and sizes. \n
  1447. */
  1448. REG_OP(ResizeGradD)
  1449. .INPUT(grads, TensorType({DT_FLOAT16, DT_FLOAT}))
  1450. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT}))
  1451. .REQUIRED_ATTR(original_size, ListInt)
  1452. .ATTR(roi, ListInt, {})
  1453. .ATTR(scales, ListFloat, {})
  1454. .ATTR(coordinate_transformation_mode, String, "half_pixel")
  1455. .ATTR(cubic_coeff_a, Float, -0.75)
  1456. .ATTR(exclude_outside, Int, 0)
  1457. .ATTR(extrapolation_value, Float, 0.0)
  1458. .ATTR(mode, String, "nearest")
  1459. .ATTR(nearest_mode, String, "round_prefer_floor")
  1460. .OP_END_FACTORY_REG(ResizeGradD)
  1461. /**
  1462. *@brief Computes the gradients of DenseImageWarp with respect to image and flow. \n
  1463. *@par Inputs:
  1464. *@li grad: gradients with respect to DenseImageWarp output.
  1465. *@li image: 4-D Tensor with shape `[batch, height, width, channels]`.
  1466. *@li flow: 4-D Tensor with shape `[batch, height, width, 2]`. \n
  1467. *@par Outputs:
  1468. *grad_image: Returns 4-D with the same shape and dtype as `image`.
  1469. *grad_flow: Returns 4-D with the same shape and dtype as `flow`. \n
  1470. */
  1471. REG_OP(DenseImageWarpGrad)
  1472. .INPUT(grad, TensorType({DT_FLOAT, DT_FLOAT16}))
  1473. .INPUT(image, TensorType({DT_FLOAT, DT_FLOAT16}))
  1474. .INPUT(flow, TensorType({DT_FLOAT, DT_FLOAT16}))
  1475. .OUTPUT(grad_image, TensorType({DT_FLOAT, DT_FLOAT16}))
  1476. .OUTPUT(grad_flow, TensorType({DT_FLOAT, DT_FLOAT16}))
  1477. .OP_END_FACTORY_REG(DenseImageWarpGrad)
  1478. /**
  1479. *@brief This operation samples input X by using interpolation based on flow field grid,
  1480. which is usually gennerated by affine_grid. The grid of shape [N, H, W, 2] is the concatenation of
  1481. (x, y) coordinates with shape [N, H, W] each, where x is indexing the 4th dimension (in width dimension) of
  1482. input data x and y is indexng the 3rd dimention (in height dimension), finally results is
  1483. the interpolation value of 4 nearest corner points. The output tensor shape will be [N, C, H, W].
  1484. *@par Inputs:
  1485. *@li x: 4-D Tensor with shape `[batch, channels, height, width]`.
  1486. *@li grid: flow field grid, 4-D Tensor with shape `[batch, height, width, 2]`.
  1487. *@par Attributes:
  1488. *@li interpolation_mode: An optional string specifying the interpolation method. Only 'bilinear' is
  1489. supported for now .
  1490. *@li padding_mode: An optional string specifying the pad method. Only 'zeros' is supported for now .
  1491. *@li align_corners: An optional bool. If "true", the centers of the corner
  1492. pixels of the input and output tensors are aligned. Defaults to "false" .
  1493. *@par Outputs:
  1494. *y: Returns 4-D Tensor with the same dtype as `X`.
  1495. *@par Third-party framework compatibility
  1496. *Compatible with pytorch GridSampler2D operator.
  1497. *@par Restrictions:
  1498. *Warning:THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  1499. */
  1500. REG_OP(GridSampler2D)
  1501. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
  1502. .INPUT(grid, TensorType({DT_FLOAT16, DT_FLOAT}))
  1503. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT}))
  1504. .ATTR(interpolation_mode, String, "bilinear")
  1505. .ATTR(padding_mode, String, "zeros")
  1506. .ATTR(align_corners, Bool, false)
  1507. .OP_END_FACTORY_REG(GridSampler2D)
  1508. /**
  1509. *@brief This operation unnormalize input Grid, which is usually gennerated by affine_grid.
  1510. *@par Inputs:
  1511. *@li grid: flow field grid, 4-D Tensor with shape `[batch, height, width, 2]`.
  1512. *@li assist: Assist matrix, a 4-D tensor of type float16.
  1513. *@par Attributes:
  1514. *@li align_corners: An optional bool. If "true", the centers of the corner
  1515. pixels of the input and output tensors are aligned. Defaults to "false" .
  1516. *@par Outputs:
  1517. *diff: Returns 4-D Tensor with the same shape and dtype as `grid`.
  1518. *position: Returns 4-D Tensor with the same shape as `grid`.
  1519. */
  1520. REG_OP(GridUnnormal)
  1521. .INPUT(grid, TensorType({DT_FLOAT16, DT_FLOAT}))
  1522. .INPUT(assist, TensorType({DT_FLOAT16, DT_FLOAT}))
  1523. .OUTPUT(diff, TensorType({DT_FLOAT16, DT_FLOAT}))
  1524. .OUTPUT(position, TensorType({DT_INT32}))
  1525. .ATTR(align_corners, Bool, false)
  1526. .OP_END_FACTORY_REG(GridUnnormal)
  1527. /**
  1528. *@brief This operation unfold input X based on unnormalized grid, which is gennerated by GridUnnormal.
  1529. *@par Inputs:
  1530. *@li x: 4-D Tensor with shape `[batch, channels, height, width]`.
  1531. *@li position: 4-D Tensor with shape `[batch, output_height, output_width, 2]`.
  1532. *@par Attributes:
  1533. *@li padding_mode: An optional string specifying the pad method. Only 'zeros' is supported for now .
  1534. *@par Outputs:
  1535. *y: Returns 4-D Tensor with the same dtype as `x`.
  1536. */
  1537. REG_OP(ImageUnfold)
  1538. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
  1539. .INPUT(position, TensorType({DT_INT32}))
  1540. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT}))
  1541. .ATTR(padding_mode, String, "zeros")
  1542. .OP_END_FACTORY_REG(ImageUnfold)
  1543. /**
  1544. *@brief This operation select images to warp_images according to offsets.
  1545. *@par Inputs:
  1546. *@li images: 4-D Tensor with shape `[batch, height, width, 3]`.
  1547. *@li offsets: 4-D Tensor with shape `[batch, 4, new_height, new_width]`.
  1548. *@par Outputs:
  1549. *warp_images: Returns 5-D Tensor with shape
  1550. `[batch, 4, new_height, new_width, 3]` and the same dtype as `images`.
  1551. */
  1552. REG_OP(IMGWarpOffsets)
  1553. .INPUT(images, TensorType({DT_UINT8, DT_FLOAT16, DT_FLOAT}))
  1554. .INPUT(offsets, TensorType({DT_FLOAT, DT_INT32}))
  1555. .OUTPUT(warp_images, TensorType({DT_UINT8, DT_FLOAT16, DT_FLOAT}))
  1556. .OP_END_FACTORY_REG(IMGWarpOffsets)
  1557. /**
  1558. *@brief This operation samples 3d input x by using interpolation based on flow field grid,
  1559. which is usually gennerated by affine_grid.
  1560. *@par Inputs:
  1561. *@li x: 5-D Tensor with shape `[batch, channels, depth, height, width]`.
  1562. *@li grid: flow field grid, 5-D Tensor with shape `[batch, depth, height, width, 2]`.
  1563. *@par Attributes:
  1564. *@li interpolation_mode: An optional string specifying the interpolation method.
  1565. *@li padding_mode: An optional string specifying the pad method.
  1566. *@li align_corners: An optional bool. If "true", the centers of the corner
  1567. pixels of the input and output tensors are aligned. Defaults to "false" .
  1568. *@par Outputs:
  1569. *y: Returns 5-D Tensor with the same dtype as `x`.
  1570. *@par Third-party framework compatibility
  1571. *Compatible with pytorch GridSampler3D operator.
  1572. *@par Restrictions:
  1573. *Warning:THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  1574. */
  1575. REG_OP(GridSampler3D)
  1576. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  1577. .INPUT(grid, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  1578. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  1579. .ATTR(interpolation_mode, String, "bilinear")
  1580. .ATTR(padding_mode, String, "zeros")
  1581. .ATTR(align_corners, Bool, false)
  1582. .OP_END_FACTORY_REG(GridSampler3D)
  1583. /**
  1584. *@brief Computes the gradients of GridSampler3D.
  1585. *@par Inputs:
  1586. *@li grad: 5-D Tensor with shape `[batch, channels, depth, height, width]`.
  1587. *@li x: 5-D Tensor with shape `[batch, channels, depth, height, width]`.
  1588. *@li grid: flow field grid, 5-D Tensor with shape `[batch, depth, height, width, 2]`.
  1589. *@par Attributes:
  1590. *@li interpolation_mode: An optional string specifying the interpolation method.
  1591. *@li padding_mode: An optional string specifying the pad method.
  1592. *@li align_corners: An optional bool. If "true", the centers of the corner
  1593. pixels of the input and output tensors are aligned. Defaults to "false" .
  1594. *@par Outputs:
  1595. *dx: Returns 5-D Tensor with the same dtype and shape as `x`.
  1596. *dgrid: Returns 5-D Tensor with the same dtype and shape as `grid`.
  1597. *@par Third-party framework compatibility
  1598. *Compatible with pytorch GridSampler3DGrad operator.
  1599. *@par Restrictions:
  1600. *Warning:THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  1601. */
  1602. REG_OP(GridSampler3DGrad)
  1603. .INPUT(grad, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  1604. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  1605. .INPUT(grid, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  1606. .OUTPUT(dx, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  1607. .OUTPUT(dgrid, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  1608. .ATTR(interpolation_mode, String, "bilinear")
  1609. .ATTR(padding_mode, String, "zeros")
  1610. .ATTR(align_corners, Bool, false)
  1611. .OP_END_FACTORY_REG(GridSampler3DGrad)
  1612. } // namespace ge
  1613. #endif // OPS_BUILT_IN_OP_PROTO_INC_IMAGE_OPS_H_

图引擎模块(GE)是MindSpore的一个子模块,其代码由C++实现,位于前端模块ME和底层硬件之间,起到承接作用。图引擎模块以ME下发的图作为输入,然后进行一系列的深度图优化操作,最后输出一张可以在底层硬件上高效运行的图。GE针对昇腾AI处理器的硬件结构特点,做了特定的优化工作,以此来充分发挥出昇腾AI处理器的强大算力。在进行模型训练/推理时,GE会被自动调用而用户并不感知。GE主要由GE API和GE Core两部分组成,详细的架构图如下所示