namespace feature
{
-template <typename T> class View;
-
-template <> class View<float> final : public nnfw::util::feature::Reader<float>
+template <typename T> class View final : public nnfw::util::feature::Reader<T>
{
public:
View(::arm_compute::ITensor *tensor) : _tensor{tensor}
const ::nnfw::util::feature::Shape &shape(void) const { return _shape; }
public:
- float at(uint32_t ch, uint32_t row, uint32_t col) const override
+ T at(uint32_t ch, uint32_t row, uint32_t col) const override
{
const auto offset = feature_index_to_byte_offset(ch, row, col);
- float *ptr = reinterpret_cast<float *>(_tensor->buffer() + offset);
+ T *ptr = reinterpret_cast<T *>(_tensor->buffer() + offset);
return *ptr;
}
public:
- float &at(uint32_t ch, uint32_t row, uint32_t col)
+ T &at(uint32_t ch, uint32_t row, uint32_t col)
{
const auto offset = feature_index_to_byte_offset(ch, row, col);
- float *ptr = reinterpret_cast<float *>(_tensor->buffer() + offset);
+ T *ptr = reinterpret_cast<T *>(_tensor->buffer() + offset);
return *ptr;
}
namespace kernel
{
-template <typename T> class View;
-
-template <> class View<float> final : public nnfw::util::kernel::Reader<float>
+template <typename T> class View final : public nnfw::util::kernel::Reader<T>
{
public:
View(::arm_compute::ITensor *tensor) : _tensor{tensor}
const ::nnfw::util::kernel::Shape &shape(void) const { return _shape; }
public:
- float at(uint32_t nth, uint32_t ch, uint32_t row, uint32_t col) const override
+ T at(uint32_t nth, uint32_t ch, uint32_t row, uint32_t col) const override
{
const auto offset = kernel_index_to_byte_offset(nth, ch, row, col);
- float *ptr = reinterpret_cast<float *>(_tensor->buffer() + offset);
+ T *ptr = reinterpret_cast<T *>(_tensor->buffer() + offset);
return *ptr;
}
public:
- float &at(uint32_t nth, uint32_t ch, uint32_t row, uint32_t col)
+ T &at(uint32_t nth, uint32_t ch, uint32_t row, uint32_t col)
{
const auto offset = kernel_index_to_byte_offset(nth, ch, row, col);
- float *ptr = reinterpret_cast<float *>(_tensor->buffer() + offset);
+ T *ptr = reinterpret_cast<T *>(_tensor->buffer() + offset);
return *ptr;
}