gussmith23 commented on a change in pull request #9816:
URL: https://github.com/apache/tvm/pull/9816#discussion_r778344021



##########
File path: include/tvm/topi/transform.h
##########
@@ -47,6 +47,92 @@ namespace topi {
 using namespace tvm::te;
 using namespace topi::detail;
 
+/*!
+ * \brief Creates an operation to form windows over the input x.
+ *
+ * \param x The input tensor.
+ * \param axis What axis the windows begin forming over. Windows will be formed
+ * over this axis and all following axes. The axis value determines the window
+ * shape (and thus, the number of strides): window shape and strides must both
+ * be of length `data.ndim-axis`.
+ * \param window_shape The window shape to form over the input. Window shape
+ * must be of length `data.ndim-axis`.
+ * \param strides How to stride the window along each dimension. Strides must 
be
+ * of length `data.ndim-axis`.
+ * \param name The name of the operation
+ * \param tag The tag to mark the operation
+ *
+ * \return A Tensor whose op member is the windows operation
+ */
+inline Tensor windows(const Tensor& x, int axis, Array<Integer> window_shape,
+                      Array<Integer> strides, std::string name = "T_windows",
+                      // TODO(@gussmith23) what to tag it?
+                      std::string tag = "") {
+  ICHECK(axis <= 0);
+  auto _axis = size_t(axis);
+  ICHECK(_axis < x->shape.size()) << "axis must be a valid dimension index of 
x.";
+  ICHECK(x->shape.size() - _axis == window_shape.size())
+      << "There must be a window shape for every dimension of x over which we 
are forming windows.";
+  ICHECK(strides.size() == window_shape.size()) << "Windows and strides should 
be the same length.";

Review comment:
       Thanks, that makes sense after looking at the implementations of CHECK 
and ICHECK. I think some of these should still be ICHECKs (if ICHECK truly 
means "internal"). I will change some of them to CHECKs, but let me know if you 
think I should make them all CHECKs.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to