nareshmlx/opencv-pr huggingface dataset:
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder
**Review Line:** 29

**Code Changes:**
```diff
 const char* keys =
     "{ help  h     | | Print help message. }"
     "{ input i     | | Path to input image or video file. Skip this argument to capture frames from a camera.}"
-    "{ model m     | | Path to a binary .pb file contains trained network.}"
+    "{ model m     | | Path to a binary .pb file contains trained detector network.}"
+    "{ ocr         | | Path to a binary .pb or .onnx file contains trained recognition network.}"
     "{ width       | 320 | Preprocess input image by resizing to a specific width. It should be multiple by 32. }"
     "{ height      | 320 | Preprocess input image by resizing to a specific height. It should be multiple by 32. }"
     "{ thr         | 0.5 | Confidence threshold. }"
     "{ nms         | 0.4 | Non-maximum suppression threshold. }";
 
```

Review comment:
Please add model conversion code to the sample (in comments at the top of file)
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder

**Code Changes:**
```diff
@@ -1,3 +1,20 @@
+/*
+    Text detection model: https://github.com/argman/EAST
+    Download link: https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1
+
+    Text recognition model taken from here: https://github.com/meijieru/crnn.pytorch
+    How to convert from pb to onnx:
+    Using classes from here: https://github.com/meijieru/crnn.pytorch/blob/master/models/crnn.py
+
+    import torch
```

Review comment:
I thing that we should scale resulting bounding boxes once at `decode_bounding_boxes`
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder

**Code Changes:**
```diff
@@ -1,3 +1,20 @@
+/*
+    Text detection model: https://github.com/argman/EAST
+    Download link: https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1
+
+    Text recognition model taken from here: https://github.com/meijieru/crnn.pytorch
+    How to convert from pb to onnx:
+    Using classes from here: https://github.com/meijieru/crnn.pytorch/blob/master/models/crnn.py
+
+    import torch
```

Review comment:
`dsize` should be a size of destination image - 100x32
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder

**Code Changes:**
```diff
@@ -1,3 +1,20 @@
+/*
+    Text detection model: https://github.com/argman/EAST
+    Download link: https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1
+
+    Text recognition model taken from here: https://github.com/meijieru/crnn.pytorch
+    How to convert from pb to onnx:
+    Using classes from here: https://github.com/meijieru/crnn.pytorch/blob/master/models/crnn.py
+
+    import torch
```

Review comment:
What is origin shape of `scores`? You may try just `Mat scores_mat = scores.reshape(1, scores.size[0]);`. Number of columns in this way is computed automatically.
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder

**Code Changes:**
```diff
@@ -1,3 +1,20 @@
+/*
+    Text detection model: https://github.com/argman/EAST
+    Download link: https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1
+
+    Text recognition model taken from here: https://github.com/meijieru/crnn.pytorch
+    How to convert from pb to onnx:
+    Using classes from here: https://github.com/meijieru/crnn.pytorch/blob/master/models/crnn.py
+
+    import torch
```

Review comment:
please remove extra line
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder
**Review Line:** 257

**Code Changes:**
```diff
+        if (elementIndex > 0 && elements[elementIndex] != '-' &&
+            elements[elementIndex - 1] != elements[elementIndex])
+        {
+            text += elements[elementIndex];
+        }
+    }
+}
\ No newline at end of file
```

Review comment:
So maybe we just don't need to push `'-'` characters to the `elements`?
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder
**Review Line:** 60

**Code Changes:**
```diff
     int inpWidth = parser.get<int>("width");
     int inpHeight = parser.get<int>("height");
-    String model = parser.get<String>("model");
+    String modelDecoder = parser.get<String>("model");
+    String modelRecognition = parser.get<String>("ocr");
 
     if (!parser.check())
     {
         parser.printErrors();
         return 1;
     }
```

Review comment:
please remove extra line
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder

**Code Changes:**
```diff
@@ -1,3 +1,20 @@
+/*
+    Text detection model: https://github.com/argman/EAST
+    Download link: https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1
+
+    Text recognition model taken from here: https://github.com/meijieru/crnn.pytorch
+    How to convert from pb to onnx:
+    Using classes from here: https://github.com/meijieru/crnn.pytorch/blob/master/models/crnn.py
+
+    import torch
```

Review comment:
Why not just `getTimeMilli()`?
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder

**Code Changes:**
```diff
@@ -1,3 +1,20 @@
+/*
+    Text detection model: https://github.com/argman/EAST
+    Download link: https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1
+
+    Text recognition model taken from here: https://github.com/meijieru/crnn.pytorch
+    How to convert from pb to onnx:
+    Using classes from here: https://github.com/meijieru/crnn.pytorch/blob/master/models/crnn.py
+
+    import torch
```

Review comment:
looks like there is no averaging of inference time. So maybe just rename to `inferenceTime`?
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder
**Review Line:** 257

**Code Changes:**
```diff
+        if (elementIndex > 0 && elements[elementIndex] != '-' &&
+            elements[elementIndex - 1] != elements[elementIndex])
+        {
+            text += elements[elementIndex];
+        }
+    }
+}
\ No newline at end of file
```

Review comment:
This function implementation is correct only because let's say the original text is 'aaaa' and the model predicted "a--aa--aaa----a" if we remove the '-'s (aaaaaaa) and then we remove the adjacent same letters then we will be left with only 'a' whereas if we use the current method we will get the correct output "aaaa"
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder

**Code Changes:**
```diff
@@ -1,3 +1,20 @@
+/*
+    Text detection model: https://github.com/argman/EAST
+    Download link: https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1
+
+    Text recognition model taken from here: https://github.com/meijieru/crnn.pytorch
+    How to convert from pb to onnx:
+    Using classes from here: https://github.com/meijieru/crnn.pytorch/blob/master/models/crnn.py
+
+    import torch
```

Review comment:
please remove unused variable
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder

**Code Changes:**
```diff
@@ -1,3 +1,20 @@
+/*
+    Text detection model: https://github.com/argman/EAST
+    Download link: https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1
+
+    Text recognition model taken from here: https://github.com/meijieru/crnn.pytorch
+    How to convert from pb to onnx:
+    Using classes from here: https://github.com/meijieru/crnn.pytorch/blob/master/models/crnn.py
+
+    import torch
```

Review comment:
Another branch with `cap.open(0);` needs similar check too. So it is better to move it down after this `if`.
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder

**Code Changes:**
```diff
@@ -1,3 +1,20 @@
+/*
+    Text detection model: https://github.com/argman/EAST
+    Download link: https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1
+
+    Text recognition model taken from here: https://github.com/meijieru/crnn.pytorch
+    How to convert from pb to onnx:
+    Using classes from here: https://github.com/meijieru/crnn.pytorch/blob/master/models/crnn.py
+
+    import torch
```

Review comment:
What is the source of this implementation?
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder
**Review Line:** 239

**Code Changes:**
```diff
+    {
+        Point p;
+        minMaxLoc(scoresMat.row(rowIndex), 0, 0, 0, &p);
+        if (p.x > 0 && static_cast<size_t>(p.x) <= alphabet.size())
+        {
+            elements.push_back(alphabet[p.x - 1]);
+        }
+        else
+        {
+            elements.push_back('-');
+        }
```

Review comment:
`if (p.x > 0 && p.x <= alphabet.size())`
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder

**Code Changes:**
```diff
@@ -1,3 +1,20 @@
+/*
+    Text detection model: https://github.com/argman/EAST
+    Download link: https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1
+
+    Text recognition model taken from here: https://github.com/meijieru/crnn.pytorch
+    How to convert from pb to onnx:
+    Using classes from here: https://github.com/meijieru/crnn.pytorch/blob/master/models/crnn.py
+
+    import torch
```

Review comment:
I took source from here https://www.pyimagesearch.com/2014/08/25/4-point-opencv-getperspective-transform-example/
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder
**Review Line:** 29

**Code Changes:**
```diff
 const char* keys =
     "{ help  h     | | Print help message. }"
     "{ input i     | | Path to input image or video file. Skip this argument to capture frames from a camera.}"
-    "{ model m     | | Path to a binary .pb file contains trained network.}"
+    "{ model m     | | Path to a binary .pb file contains trained detector network.}"
+    "{ ocr         | | Path to a binary .pb or .onnx file contains trained recognition network.}"
     "{ width       | 320 | Preprocess input image by resizing to a specific width. It should be multiple by 32. }"
     "{ height      | 320 | Preprocess input image by resizing to a specific height. It should be multiple by 32. }"
     "{ thr         | 0.5 | Confidence threshold. }"
     "{ nms         | 0.4 | Non-maximum suppression threshold. }";
 
```

Review comment:
Please add links to text detection and optional text recognition models into this file (as comment at the top).
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder

**Code Changes:**
```diff
@@ -1,3 +1,20 @@
+/*
+    Text detection model: https://github.com/argman/EAST
+    Download link: https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1
+
+    Text recognition model taken from here: https://github.com/meijieru/crnn.pytorch
+    How to convert from pb to onnx:
+    Using classes from here: https://github.com/meijieru/crnn.pytorch/blob/master/models/crnn.py
+
+    import torch
```

Review comment:
Please use `camelCase`
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder

**Code Changes:**
```diff
@@ -1,3 +1,20 @@
+/*
+    Text detection model: https://github.com/argman/EAST
+    Download link: https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1
+
+    Text recognition model taken from here: https://github.com/meijieru/crnn.pytorch
+    How to convert from pb to onnx:
+    Using classes from here: https://github.com/meijieru/crnn.pytorch/blob/master/models/crnn.py
+
+    import torch
```

Review comment:
Please remove trailing whitespaces
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder

**Code Changes:**
```diff
@@ -1,3 +1,20 @@
+/*
+    Text detection model: https://github.com/argman/EAST
+    Download link: https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1
+
+    Text recognition model taken from here: https://github.com/meijieru/crnn.pytorch
+    How to convert from pb to onnx:
+    Using classes from here: https://github.com/meijieru/crnn.pytorch/blob/master/models/crnn.py
+
+    import torch
```

Review comment:
Seems to me we need to move it outside the loop
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder

**Code Changes:**
```diff
@@ -1,3 +1,20 @@
+/*
+    Text detection model: https://github.com/argman/EAST
+    Download link: https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1
+
+    Text recognition model taken from here: https://github.com/meijieru/crnn.pytorch
+    How to convert from pb to onnx:
+    Using classes from here: https://github.com/meijieru/crnn.pytorch/blob/master/models/crnn.py
+
+    import torch
```

Review comment:
Am I right that left top vertex is used as a start point? If so, please use `vertices` array (it contains this point).
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder
**Review Line:** 257

**Code Changes:**
```diff
+        if (elementIndex > 0 && elements[elementIndex] != '-' &&
+            elements[elementIndex - 1] != elements[elementIndex])
+        {
+            text += elements[elementIndex];
+        }
+    }
+}
\ No newline at end of file
```

Review comment:
I checked it works correctly
**File:** samples/dnn/text_detection.cpp
**Change Type:** modified
**Context:** PR #16941: Add text recognition to examples_dnn_text_decoder

**Code Changes:**
```diff
@@ -1,3 +1,20 @@
+/*
+    Text detection model: https://github.com/argman/EAST
+    Download link: https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1
+
+    Text recognition model taken from here: https://github.com/meijieru/crnn.pytorch
+    How to convert from pb to onnx:
+    Using classes from here: https://github.com/meijieru/crnn.pytorch/blob/master/models/crnn.py
+
+    import torch
```

Review comment:
unused variable
**File:** 3rdparty/libtengine/tengine.cmake
**Change Type:** modified
**Context:** PR #17468: TEngine installation rules fix for static build

**Code Changes:**
```diff
@@ -22,7 +22,7 @@
 #         sqfu@openailab.com
 #
 
-SET(TENGINE_COMMIT_VERSION "2f3cd86217f3530c8e4a82f3ed5af14c7a4e3943")
+SET(TENGINE_COMMIT_VERSION "8a4c58e0e05cd850f4bb0936a330edc86dc0e28c")
 SET(OCV_TENGINE_DIR "${OpenCV_BINARY_DIR}/3rdparty/libtengine")
 SET(OCV_TENGINE_SOURCE_PATH "${OCV_TENGINE_DIR}/Tengine-${TENGINE_COMMIT_VERSION}")
 
@@ -34,7 +34,7 @@ IF(EXISTS "${OCV_TENGINE_SOURCE_PATH}")
```

Review comment:
I think it is already done on line 63
**File:** 3rdparty/libtengine/tengine.cmake
**Change Type:** modified
**Context:** PR #17468: TEngine installation rules fix for static build

**Code Changes:**
```diff
@@ -22,7 +22,7 @@
 #         sqfu@openailab.com
 #
 
-SET(TENGINE_COMMIT_VERSION "2f3cd86217f3530c8e4a82f3ed5af14c7a4e3943")
+SET(TENGINE_COMMIT_VERSION "8a4c58e0e05cd850f4bb0936a330edc86dc0e28c")
 SET(OCV_TENGINE_DIR "${OpenCV_BINARY_DIR}/3rdparty/libtengine")
 SET(OCV_TENGINE_SOURCE_PATH "${OCV_TENGINE_DIR}/Tengine-${TENGINE_COMMIT_VERSION}")
 
@@ -34,7 +34,7 @@ IF(EXISTS "${OCV_TENGINE_SOURCE_PATH}")
```

Review comment:
The solution is not good enough too. There are 2 issues: - TEngine library is not installed. It means that it's missing from Android SDK and other builds that are done with cross-compiler. - There is build path leak to final CMake config: ``` ~/Projects/OpenCV/opencv-master-arm64/install/lib/cmake/opencv4$ grep -Rin tengine OpenCVModules.cmake:146: INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:opencv_core>;\$<LINK_ONLY:opencv_imgproc>;opencv_core;opencv_imgproc;\$<LINK_ONLY:dl>;\$<LINK_ONLY:m>;\$<LINK_ONLY:pthread>;\$<LINK_ONLY:rt>;\$<LINK_ONLY:tegra_hal>;\$<LINK_ONLY:libprotobuf>;/home/alexander/Projects/OpenCV/opencv-master-arm64/lib//libtengine.a" ```
**File:** modules/core/include/opencv2/core/eigen.hpp
**Change Type:** modified
**Context:** PR #17368: Add documentation about usage of cv2eigen functions in eigen.hpp

**Code Changes:**
```diff
@@ -66,10 +66,18 @@
 namespace cv
 {
 
-//! @addtogroup core_eigen
+/** @addtogroup core_eigen
+These functions are provided for OpenCV-Eigen interoperability. They convert `Mat`
+objects to corresponding `Eigen::Matrix` objects and vice-versa. Consult the [Eigen
+documentation](https://eigen.tuxfamily.org/dox/group__TutorialMatrixClass.html) for
+information about the `Matrix` template type.
```

Review comment:
> addtogroup Should go into "cv" namespace, see addtogroup command below.
**File:** modules/core/include/opencv2/core/eigen.hpp
**Change Type:** modified
**Context:** PR #17368: Add documentation about usage of cv2eigen functions in eigen.hpp

**Code Changes:**
```diff
@@ -66,10 +66,18 @@
 namespace cv
 {
 
-//! @addtogroup core_eigen
+/** @addtogroup core_eigen
+These functions are provided for OpenCV-Eigen interoperability. They convert `Mat`
+objects to corresponding `Eigen::Matrix` objects and vice-versa. Consult the [Eigen
+documentation](https://eigen.tuxfamily.org/dox/group__TutorialMatrixClass.html) for
+information about the `Matrix` template type.
```

Review comment:
Wrong place. It must be a group documentation instead of single function's note under `#ifdef`
**File:** modules/core/include/opencv2/core/eigen.hpp
**Change Type:** modified
**Context:** PR #17368: Add documentation about usage of cv2eigen functions in eigen.hpp

**Code Changes:**
```diff
@@ -66,10 +66,18 @@
 namespace cv
 {
 
-//! @addtogroup core_eigen
+/** @addtogroup core_eigen
+These functions are provided for OpenCV-Eigen interoperability. They convert `Mat`
+objects to corresponding `Eigen::Matrix` objects and vice-versa. Consult the [Eigen
+documentation](https://eigen.tuxfamily.org/dox/group__TutorialMatrixClass.html) for
+information about the `Matrix` template type.
```

Review comment:
Still wrong. http://pullrequest.opencv.org/buildbot/export/pr/17368/docs/d0/daf/group__core__eigen.html
**File:** modules/dnn/src/layers/elementwise_layers.cpp
**Change Type:** modified
**Context:** PR #15808: Added Swish and Mish activations - I have added the Swish and Mish activation functions. This resolves https://github.com/opencv/opencv/iss...
**Review Line:** 743

**Code Changes:**
```diff
+        for (size_t i = 0; i < inputs.size(); i++)
+        {
+            UMat& src = inputs[i];
+            UMat& dst = outputs[i];
+
+            ocl::Kernel kernel("MishForward", ocl::dnn::activations_oclsrc, buildopt);
+            kernel.set(0, (int)src.total());
+            kernel.set(1, ocl::KernelArg::PtrReadOnly(src));
+            kernel.set(2, ocl::KernelArg::PtrWriteOnly(dst));
+
+            size_t gSize = src.total();
```

Review comment:
Missed kernel implementation?
**File:** modules/dnn/src/cuda4dnn/kernels/activations.hpp
**Change Type:** modified
**Context:** PR #15808: Added Swish and Mish activations - I have added the Swish and Mish activation functions. This resolves https://github.com/opencv/opencv/iss...
**Review Line:** 25

**Code Changes:**
```diff
 
+    template <class T>
+    void swish(const csl::Stream& stream, csl::Span<T> output, csl::View<T> input);
+
+    template <class T>
+    void mish(const csl::Stream& stream, csl::Span<T> output, csl::View<T> input);
+
     template <class T>
     void sigmoid(const csl::Stream& stream, csl::Span<T> output, csl::View<T> input);
 
```

Review comment:
Missed implementation?
**File:** modules/dnn/src/cuda4dnn/kernels/activations.hpp
**Change Type:** modified
**Context:** PR #15808: Added Swish and Mish activations - I have added the Swish and Mish activation functions. This resolves https://github.com/opencv/opencv/iss...
**Review Line:** 25

**Code Changes:**
```diff
 
+    template <class T>
+    void swish(const csl::Stream& stream, csl::Span<T> output, csl::View<T> input);
+
+    template <class T>
+    void mish(const csl::Stream& stream, csl::Span<T> output, csl::View<T> input);
+
     template <class T>
     void sigmoid(const csl::Stream& stream, csl::Span<T> output, csl::View<T> input);
 
```

Review comment:
I have added the kernel implementation. Can you please help me with adding tests?
**File:** modules/dnn/src/cuda4dnn/kernels/activations.hpp
**Change Type:** modified
**Context:** PR #15808: Added Swish and Mish activations - I have added the Swish and Mish activation functions. This resolves https://github.com/opencv/opencv/iss...
**Review Line:** 25

**Code Changes:**
```diff
 
+    template <class T>
+    void swish(const csl::Stream& stream, csl::Span<T> output, csl::View<T> input);
+
+    template <class T>
+    void mish(const csl::Stream& stream, csl::Span<T> output, csl::View<T> input);
+
     template <class T>
     void sigmoid(const csl::Stream& stream, csl::Span<T> output, csl::View<T> input);
 
```

Review comment:
It depends on origin implementation: TensorFlow new tests example: https://github.com/opencv/opencv/pull/15303/ + https://github.com/opencv/opencv_extra/pull/661 PyTorch new tests example: https://github.com/opencv/opencv/pull/15168 + https://github.com/opencv/opencv_extra/pull/651
**File:** modules/dnn/src/cuda/activations.cu
**Change Type:** modified
**Context:** PR #15808: Added Swish and Mish activations - I have added the Swish and Mish activation functions. This resolves https://github.com/opencv/opencv/iss...

**Code Changes:**
```diff
@@ -62,6 +62,43 @@ namespace cv { namespace dnn { namespace cuda4dnn  { namespace kernels {
             }
         }
 
+        template <class T, std::size_t N>
+        __global__ void swish_vec(Span<T> output, View<T> input) {
+            using vector_type = get_vector_type_t<T, N>;
+
+            auto output_vPtr = vector_type::get_pointer(output.data());
+            auto input_vPtr = vector_type::get_pointer(input.data());
```

Review comment:
Shouldn't `1.0f` be `T(1.0)`? This will enable some compiler optimizations in half-precision kernels. The `1.0f` will cause an upcast of the `__half` temporary returned by `exp` to `float` which is unnecessary.