@@ -63,11 +63,22 @@ class StripeConfigNode : public Object {
6363 * \return The strides of the stripe config.
6464 * \note The strides refer to the stride between stripes in each axis.
6565 * The strides are represented as a float rather than an int to account for
66- * cases of 'fractional striding'. This may happen, for instance, with an
67- * upscaling operation where elements of the affine transformation matrix
68- * are not integers. In this case we can't simply round the strides as the
69- * error will compound when we need to multiply the strides by the number of
70- * stripes along a given axis.
66+ * cases of 'fractional striding'. The stride should therefore be interpreted
67+ * as the average striding in each axis.
68+ *
69+ * The starting offset of the i-th stripe in axis 'ax' is given by:
70+ *
71+ * stripe_offset_i[ax] = offset[ax] + floor(strides[ax]*i)
72+ *
73+ * As a concrete example, consider a 2x2 upscaling operation. If an output
74+ * stripe config with a stride of (3, 3) is chosen, then when this is
75+ * propagated to the input it will be reduced by a factor of two to become
76+ * (1.5, 1.5).
77+ *
78+ * This means the first stripe in axis 0 should begin at (floor(1.5*0), 0) = (0, 0),
79+ * the second at (floor(1.5*1), 0) = (1, 0), and the third at (floor(1.5*2), 0) =
80+ * (3, 0). This results in irregular striding where 'strides' is the average
81+ * striding value.
7182 */
7283 inline std::vector<float > GetStrides () const { return strides_; }
7384 /* !
@@ -91,8 +102,9 @@ class StripeConfigNode : public Object {
91102 * \brief Get the offset of the stripe config.
92103 * \return The offset of the stripe config.
93104 * \note The offset refers to the offset of the first stripe
94- * from the first element of the tensor. For example, in a 2D padding operation
95- * that is padding by 1 in every dimension, the offset would be [-1, -1].
105+ * from the first element of the tensor. For example, in a slice operation
106+ * which only returns the second (4, 8) half of a (8, 8) tensor, the offset
107+ * would need to be [4, 0].
96108 */
97109 inline std::vector<int > GetOffset () const { return offset_; }
98110 /* ! \return The hash of the StripeConfigNode */
@@ -135,15 +147,20 @@ class StripeConfigNode : public Object {
135147 * The size of that stripe in each axis is the 'shape'. The strides is how far
136148 * you should move between stripes, so also (4, 4) for a simple non-overlappping
137149 * tiling. However, we explore some overlapping scheduling options so shape != strides
138- * in general. The 'extent' is simply (12, 12), the region over which we're conducting
139- * our tiling.
150+ * in general. Note that the striding may be fractional, for instance (1.5, 1.5).
151+ * This means the first stripe should begin at (floor(1.5*0), 0) = (0, 0), the second
152+ * at (floor(1.5*1), 0) = (1, 0), and the third at (floor(1.5*2), 0) = (3, 0). This results
153+ * in slightly irregular striding where 'strides' should be interpreted as the average
154+ * striding value.
155+ *
156+ * The 'extent' is simply (12, 12), the region over which we're conducting our tiling.
140157 *
141158 * The 'order' tells us which axis to iterate over first and which second and the
142159 * 'stripes' tells us how many stripes we need to compute in each of those axes.
143160 *
144161 * Finally, the 'offset' tells us where to start the first stripe. In this simple
145- * case the offset is just (0, 0), but in something like a padding operation we
146- * may want to start from a negative index, which is captured by the offset .
162+ * case the offset is just (0, 0), but in something like a slice operation we
163+ * may want to start part way through a tensor .
147164 */
148165class StripeConfig : public ObjectRef {
149166 public:
0 commit comments