--- /dev/null
+#ifndef __NNFW_UTIL_VECTOR_OBJECT_H__
+#define __NNFW_UTIL_VECTOR_OBJECT_H__
+
+#include "util/vector/Reader.h"
+
+#include <vector>
+#include <functional>
+
+namespace nnfw
+{
+namespace util
+{
+namespace vector
+{
+
+template<typename T> class Object final : public Reader<T>
+{
+public:
+ using Generator = std::function<T (int32_t size, int32_t offset)>;
+
+public:
+ Object(int32_t size, const Generator &gen) : _size{size}
+ {
+ _value.resize(_size);
+
+ for (int32_t offset = 0; offset < size; ++offset)
+ {
+ _value.at(offset) = gen(size, offset);
+ }
+ }
+
+public:
+ int32_t size(void) const { return _size; }
+
+public:
+ T at(uint32_t nth) const override { return _value.at(nth); }
+
+private:
+ const int32_t _size;
+ std::vector<T> _value;
+};
+
+} // namespace vector
+} // namespace util
+} // namespace nnfw
+
+#endif // __NNFW_UTIL_VECTOR_OBJECT_H__
--- /dev/null
+#ifndef __NNFW_UTIL_VECTOR_READER_H__
+#define __NNFW_UTIL_VECTOR_READER_H__
+
+#include <cstdint>
+
+namespace nnfw
+{
+namespace util
+{
+namespace vector
+{
+
+template <typename T> struct Reader
+{
+ virtual ~Reader() = default;
+
+ virtual T at(uint32_t nth) const = 0;
+};
+
+} // namespace vector
+} // namespace util
+} // namespace nnfw
+
+#endif // __NNFW_UTIL_VECTOR_READER_H__
+++ /dev/null
-#ifndef __NN_H__
-#define __NN_H__
-
-#include <vector>
-
-#include <cstdint>
-
-namespace vector
-{
-
-template <typename T> struct View
-{
- virtual ~View() = default;
-
- virtual int32_t size(void) const = 0;
- virtual T at(uint32_t off) const = 0;
-};
-
-}
-
-class SampleBiasObject final : public vector::View<float>
-{
-public:
- SampleBiasObject(int32_t size);
-
-public:
- int32_t size(void) const override;
-
-public:
- float at(uint32_t off) const override;
-
-private:
- int32_t _size;
-};
-
-#endif
+++ /dev/null
-#include <nn.h>
-
-#include <cassert>
-
-//
-// SampleBiasObject
-//
-SampleBiasObject::SampleBiasObject(int32_t size) : _size(size)
-{
- // DO NOTHING
-}
-
-int32_t SampleBiasObject::size(void) const { return _size; }
-
-float SampleBiasObject::at(uint32_t off) const { return 0.0f; }
#include "tensorflow/contrib/lite/model.h"
#include "tensorflow/contrib/lite/builtin_op_data.h"
-#include "nn.h"
#include "env.h"
+#include "util/vector/Object.h"
#include "util/feature/RandomObject.h"
#include "util/feature/Reader.h"
#include "util/kernel/RandomObject.h"
const nnfw::util::feature::RandomObject<float> ifm{nnfw::util::feature::Shape{IFM_C, IFM_H, IFM_W}};
const nnfw::util::kernel::RandomObject<float> kernel{nnfw::util::kernel::Shape{KER_N, KER_C, KER_H, KER_W}};
- const SampleBiasObject bias{KER_N};
+ const nnfw::util::vector::Object<float> bias{KER_N, [] (uint32_t, uint32_t) { return 0.0f; }};
std::cout << "Configurations:" << std::endl;
#define PRINT_NEWLINE() { std::cout << std::endl; }