mbaret commented on a change in pull request #9458:
URL: https://github.com/apache/tvm/pull/9458#discussion_r756737741



##########
File path: src/contrib/ethosu/cascader/stripe_config.h
##########
@@ -0,0 +1,218 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ * \file src/contrib/ethosu/cascader/stripe_config.h
+ * \brief StripeConfig object for the NPU cascader
+ */
+#ifndef TVM_CONTRIB_ETHOSU_CASCADER_STRIPE_CONFIG_H_
+#define TVM_CONTRIB_ETHOSU_CASCADER_STRIPE_CONFIG_H_
+
+#include <tvm/node/reflection.h>
+#include <tvm/runtime/object.h>
+
+#include <functional>
+#include <map>
+#include <vector>
+
+namespace tvm {
+namespace contrib {
+namespace ethosu {
+namespace cascader {
+
+class StripeConfig;
+class PropagatorNode;
+
+/*! \brief Node to represent a StripeConfig */
+class StripeConfigNode : public Object {
+ public:
+  void VisitAttrs(AttrVisitor* v);
+
+  /*!
+   * \brief Get the shape of the stripe config.
+   * \return The shape of the stripe config.
+   * \note The shape refers to the size of the stripes in each dimension.
+   */
+  inline std::vector<int> GetShape() const { return shape_; }
+  /*!
+   * \brief Get the extent of the stripe config.
+   * \return The extent of the stripe config.
+   * \note The extent refers to the extent over which a StripeConfig operates.
+   * Specifically, it is the extent in each axis between the lowest value read
+   * by a stripe and the highest value read by a stripe.
+   */
+  inline std::vector<int> GetExtent() const { return extent_; }
+  /*!
+   * \brief Get the strides of the stripe config.
+   * \return The strides of the stripe config.
+   * \note The strides refer to the stride between stripes in each axis.
+   * The strides are represented as a float rather than an int to account for
+   * cases of 'fractional striding'. This may happen, for instance, with an
+   * upscaling operation where elements of the affine transformation matrix
+   * are not integers. In this case we can't simply round the strides as the
+   * error will compound when we need to multiply the strides by the number of
+   * stripes along a given axis.
+   */
+  inline std::vector<float> GetStrides() const { return strides_; }

Review comment:
       The best example of this is an upscale operation. If we have a 2x2 
upscale and choose to stripe the output in 3x3 stripes, the input stripes will 
get a fractional stride of 3/2. We can't just ceil round this, otherwise as we 
increase the striding it'll get further and further from the truth. I'll add 
this to the docs.
   
   Side note: I have considered re-expressing this as a rational number rather 
than a float, but I think that can be a future improvement for now.




-- 
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