This commit extracts `Coordinate4D` class from `ParentInfo` to use in other classes generally.
Signed-off-by: sjsujinkim <sjsujin.kim@samsung.com>
auto input_shape_4D = _ctx.at(input_index).lower_info()->shape();
std::vector<int32_t> offset = {0, 0, 0, 0};
offset[axis] = axis_point;
- graph::operand::ParentInfo::Coordinate4D coordinate_info(offset[0], offset[1], offset[2],
- offset[3]);
+ neurun::util::feature::Coordinate4D coordinate_info(offset[0], offset[1], offset[2], offset[3]);
std::unique_ptr<graph::operand::ParentInfo> parentInfo =
nnfw::make_unique<graph::operand::ParentInfo>(output_index, coordinate_info);
#define __NEURUN_COMPILER_SUBTENSOR_INFO_H__
#include "graph/operand/Object.h"
+#include "util/feature/Coordinate4D.h"
namespace neurun
{
* @brief Return tensor's offset in parent tensor
* @return Tensor offset
*/
- const graph::operand::ParentInfo::Coordinate4D offset(void) const { return _offset; }
+ const neurun::util::feature::Coordinate4D offset(void) const { return _offset; }
private:
const graph::operand::Index _parent;
const graph::operand::Shape _shape;
const graph::operand::TypeInfo _type;
- const graph::operand::ParentInfo::Coordinate4D _offset;
+ const neurun::util::feature::Coordinate4D _offset;
};
} // compiler
#include <stdint.h>
#include "Index.h"
+#include "util/feature/Coordinate4D.h"
namespace neurun
{
namespace operand
{
+using neurun::util::feature::Coordinate4D;
+
/**
* @brief Class to represent parent operand in child operand
*/
{
public:
/**
- * @brief Class to represent position(offset) of subtensor.\n
- * Assume that parent and child are already lowered (can get Shape4D).
- */
- class Coordinate4D
- {
- public:
- /**
- * @brief Construct a new Coordinate4D object
- */
- Coordinate4D(void) : _n{0}, _h{0}, _w{0}, _c{0}
- {
- // DO NOTHING
- }
- /**
- * @brief Construct a new Coordinate4D object
- * @param[in] n Batch offset
- * @param[in] h Height offset
- * @param[in] w Width offset
- * @param[in] c Channel offset
- * @return
- */
- Coordinate4D(int32_t n, int32_t h, int32_t w, int32_t c) : _n{n}, _h{h}, _w{w}, _c{c}
- {
- // DO NOTHING
- }
-
- public:
- /**
- * @brief Return batch offset
- * @return Batch offset
- */
- int32_t n(void) const { return _n; }
- /**
- * @brief Return height offset
- * @return Height offset
- */
- int32_t h(void) const { return _h; }
- /**
- * @brief Return width offset
- * @return Width offset
- */
- int32_t w(void) const { return _w; }
- /**
- * @brief Return channel offset
- * @return Channel offset
- */
- int32_t c(void) const { return _c; }
-
- private:
- int32_t _n;
- int32_t _h;
- int32_t _w;
- int32_t _c;
- };
-
-public:
- /**
* @brief Construct a new ParentInfo object
* @param[in] parent Index of parent operand
* @param[in] coordinate Offset of child operand in parent operand
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed 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.
+ */
+
+#ifndef __NEURUN_UTIL_FEATURE_COORDINATE_4D_H__
+#define __NEURUN_UTIL_FEATURE_COORDINATE_4D_H__
+
+#include <stdint.h>
+
+namespace neurun
+{
+namespace util
+{
+namespace feature
+{
+
+/**
+ * @brief Class to represent position(offset) of subtensor.\n
+ * Assume that parent and child are already lowered (can get Shape4D).
+ */
+class Coordinate4D
+{
+public:
+ /**
+ * @brief Construct a new Coordinate4D object
+ */
+ Coordinate4D(void) : _n{0}, _h{0}, _w{0}, _c{0}
+ {
+ // DO NOTHING
+ }
+ /**
+ * @brief Construct a new Coordinate4D object
+ * @param[in] n Batch offset
+ * @param[in] h Height offset
+ * @param[in] w Width offset
+ * @param[in] c Channel offset
+ * @return
+ */
+ Coordinate4D(int32_t n, int32_t h, int32_t w, int32_t c) : _n{n}, _h{h}, _w{w}, _c{c}
+ {
+ // DO NOTHING
+ }
+
+public:
+ /**
+ * @brief Return batch offset
+ * @return Batch offset
+ */
+ int32_t n(void) const { return _n; }
+ /**
+ * @brief Return height offset
+ * @return Height offset
+ */
+ int32_t h(void) const { return _h; }
+ /**
+ * @brief Return width offset
+ * @return Width offset
+ */
+ int32_t w(void) const { return _w; }
+ /**
+ * @brief Return channel offset
+ * @return Channel offset
+ */
+ int32_t c(void) const { return _c; }
+
+private:
+ int32_t _n;
+ int32_t _h;
+ int32_t _w;
+ int32_t _c;
+};
+
+} // namespace feature
+} // namespace util
+} // namespace neurun
+
+#endif // __NEURUN_UTIL_FEATURE_COORDINATE_4D_H__