switch (weight_type)
{
- case ::neurun::internal::operand::DataType::TENSOR_FLOAT32:
+ case ::neurun::graph::operand::DataType::TENSOR_FLOAT32:
{
return [num_output, ifm_shape, weight_base, weight_size](::arm_compute::ITensor &tensor) {
const ::nnfw::util::kernel::Shape ker_shape{num_output, ifm_shape.C, ifm_shape.H,
};
};
}
- case ::neurun::internal::operand::DataType::TENSOR_QUANT8_ASYMM:
+ case ::neurun::graph::operand::DataType::TENSOR_QUANT8_ASYMM:
{
return [num_output, ifm_shape, weight_base, weight_size](::arm_compute::ITensor &tensor) {
const ::nnfw::util::kernel::Shape ker_shape{num_output, ifm_shape.C, ifm_shape.H,
switch (bias_type)
{
- case ::neurun::internal::operand::DataType::TENSOR_FLOAT32:
+ case ::neurun::graph::operand::DataType::TENSOR_FLOAT32:
{
return [bias_base, bias_size](::arm_compute::ITensor &tensor) {
for (uint32_t n = 0; n < bias_size; ++n)
}
};
}
- case ::neurun::internal::operand::DataType::TENSOR_QUANT8_ASYMM:
+ case ::neurun::graph::operand::DataType::TENSOR_QUANT8_ASYMM:
{
return [bias_base, bias_size](::arm_compute::ITensor &tensor) {
for (uint32_t n = 0; n < bias_size; ++n)
return ANEURALNETWORKS_BAD_DATA;
}
- ::neurun::internal::operand::Shape shape(type->dimensionCount);
- ::neurun::internal::operand::TypeInfo typeInfo((OperandCode)(type->type), type->scale,
- type->zeroPoint);
+ ::neurun::graph::operand::Shape shape(type->dimensionCount);
+ ::neurun::graph::operand::TypeInfo typeInfo((OperandCode)(type->type), type->scale,
+ type->zeroPoint);
for (uint32_t axis = 0; axis < type->dimensionCount; ++axis)
{
return ANEURALNETWORKS_BAD_DATA;
}
- using ::neurun::internal::operand::CachedData;
+ using ::neurun::graph::operand::CachedData;
model->deref().setOperandValue(
ind, nnfw::make_unique<CachedData>(reinterpret_cast<const uint8_t *>(buffer), length));
return ANEURALNETWORKS_BAD_DATA;
}
- using ::neurun::internal::operand::ExternalData;
+ using ::neurun::graph::operand::ExternalData;
model->deref().setOperandValue(
ind, nnfw::make_unique<ExternalData>(
namespace graph
{
-operand::Index Graph::addOperand(const ::neurun::internal::operand::Shape &shape,
- const ::neurun::internal::operand::TypeInfo &type)
+operand::Index Graph::addOperand(const operand::Shape &shape, const operand::TypeInfo &type)
{
assert(_phase == Phase::BUILDING);
return _operands.append(shape, type);
return _operations.append(std::move(node));
}
-void Graph::setOperandValue(const operand::Index &ind,
- std::unique_ptr<::neurun::internal::operand::Data> &&data)
+void Graph::setOperandValue(const operand::Index &ind, std::unique_ptr<operand::Data> &&data)
{
assert(_phase == Phase::BUILDING);
assert(_operands.exist(ind));
// Graph Building
public:
- operand::Index addOperand(const ::neurun::internal::operand::Shape &shape,
- const ::neurun::internal::operand::TypeInfo &type);
+ operand::Index addOperand(const operand::Shape &shape, const operand::TypeInfo &type);
operation::Index addOperation(std::unique_ptr<operation::Node> &&node);
operation::Index insertOperation(const operand::Index &prev_operand_index,
const operation::Index &next_operation_index,
std::unique_ptr<operation::Node> &&node);
- void setOperandValue(const operand::Index &ind,
- std::unique_ptr<::neurun::internal::operand::Data> &&data);
+ void setOperandValue(const operand::Index &ind, std::unique_ptr<operand::Data> &&data);
void addInput(const operand::Index &ind);
void addOutput(const operand::Index &ind);
void finishBuilding(void);
-#ifndef __NEURUN_INTERNAL_OPERAND_DATA_H__
-#define __NEURUN_INTERNAL_OPERAND_DATA_H__
+#ifndef __NEURUN_GRAPH_OPERAND_DATA_H__
+#define __NEURUN_GRAPH_OPERAND_DATA_H__
#include <algorithm>
namespace neurun
{
-namespace internal
+namespace graph
{
namespace operand
{
};
} // namespace operand
-} // namespace internal
+} // namespace graph
} // namespace neurun
-#endif // __NEURUN_INTERNAL_OPERAND_DATA_H__
+#endif // __NEURUN_GRAPH_OPERAND_DATA_H__
-#ifndef __NEURUN_INTERNAL_OPERAND_DATATYPE_H__
-#define __NEURUN_INTERNAL_OPERAND_DATATYPE_H__
+#ifndef __NEURUN_GRAPH_OPERAND_DATATYPE_H__
+#define __NEURUN_GRAPH_OPERAND_DATATYPE_H__
namespace neurun
{
-namespace internal
+namespace graph
{
namespace operand
{
};
} // namespace operand
-} // namespace internal
+} // namespace graph
} // namespace neurun
-#endif // __NEURUN_INTERNAL_OPERAND_DATA_H__
+#endif // __NEURUN_GRAPH_OPERAND_DATATYPE_H__
#include <initializer_list>
#include <vector>
-#include "graph/operand/Index.h"
+#include "Index.h"
namespace neurun
{
namespace neurun
{
-namespace internal
+namespace graph
{
namespace operand
{
}
} // namespace operand
-} // namespace internal
+} // namespace graph
} // namespace neurun
-#ifndef __NEURUN_INTERNAL_OPERAND_OBJECT_H__
-#define __NEURUN_INTERNAL_OPERAND_OBJECT_H__
+#ifndef __NEURUN_GRAPH_OPERAND_OBJECT_H__
+#define __NEURUN_GRAPH_OPERAND_OBJECT_H__
#include <cassert>
#include <cstdint>
namespace neurun
{
-namespace internal
+namespace graph
{
namespace operand
{
};
} // namespace operand
-} // namespace internal
+} // namespace graph
} // namespace neurun
-#endif // __NEURUN_INTERNAL_OPERAND_OBJECT_H__
+#endif // __NEURUN_GRAPH_OPERAND_OBJECT_H__
return Index{_index_count++};
}
-Index Set::append(const internal::Shape &shape, const internal::TypeInfo &type)
+Index Set::append(const Shape &shape, const TypeInfo &type)
{
auto index = generateIndex();
- _objects[index.asInt()] = nnfw::make_unique<internal::Object>(shape, type);
+ _objects[index.asInt()] = nnfw::make_unique<Object>(shape, type);
return index;
}
-const internal::Object &Set::at(const Index &index) const { return *(_objects.at(index.asInt())); }
+const Object &Set::at(const Index &index) const { return *(_objects.at(index.asInt())); }
-internal::Object &Set::at(const Index &index) { return *(_objects.at(index.asInt())); }
+Object &Set::at(const Index &index) { return *(_objects.at(index.asInt())); }
bool Set::exist(const Index &index) const { return index.asInt() < _objects.size(); }
#include <memory>
#include <map>
-#include "internal/operand/Object.h"
+#include "Object.h"
#include "Index.h"
namespace neurun
namespace operand
{
-namespace
-{
-namespace internal = ::neurun::internal::operand;
-}
-
class Set
{
public:
Set() : _index_count(0) {}
public:
- Index append(const internal::Shape &, const internal::TypeInfo &);
+ Index append(const Shape &, const TypeInfo &);
public:
- const internal::Object &at(const Index &) const;
- internal::Object &at(const Index &);
+ const Object &at(const Index &) const;
+ Object &at(const Index &);
bool exist(const Index &) const;
private:
const Index generateIndex();
private:
- std::map<uint32_t, std::unique_ptr<internal::Object>> _objects;
+ std::map<uint32_t, std::unique_ptr<Object>> _objects;
uint32_t _index_count;
};
#include <cassert>
-#include "internal/operand/Shape.h"
+#include "Shape.h"
namespace neurun
{
-namespace internal
+namespace graph
{
namespace operand
{
}
} // namespace operand
-} // namespace internal
+} // namespace graph
} // namespace neurun
-#ifndef __NEURUN_INTERNAL_OPERAND_SHAPE_H__
-#define __NEURUN_INTERNAL_OPERAND_SHAPE_H__
+#ifndef __NEURUN_GRAPH_OPERAND_SHAPE_H__
+#define __NEURUN_GRAPH_OPERAND_SHAPE_H__
#include <vector>
#include <cstdint>
namespace neurun
{
-namespace internal
+namespace graph
{
namespace operand
{
};
} // namespace operand
-} // namespace internal
+} // namespace graph
} // namespace neurun
-#endif // __NEURUN_INTERNAL_OPERAND_SHAPE_H__
+#endif // __NEURUN_GRAPH_OPERAND_SHAPE_H__
namespace neurun
{
-namespace internal
+namespace graph
{
namespace operand
{
DataType TypeInfo::typeFromOperandCode(OperandCode type)
{
- // Now neurun::internal::operand::DataType share same enum value with OperandCode
+ // Now neurun::graph::operand::DataType share same enum value with OperandCode
// in NeuralNetworks.h.
return static_cast<DataType>(static_cast<uint32_t>(type));
}
} // namespace operand
-} // namespace internal
+} // namespace graph
} // namespace neurun
-#ifndef __NEURUN_INTERNAL_OPERAND_TYPEINFO_H__
-#define __NEURUN_INTERNAL_OPERAND_TYPEINFO_H__
+#ifndef __NEURUN_GRAPH_OPERAND_TYPEINFO_H__
+#define __NEURUN_GRAPH_OPERAND_TYPEINFO_H__
#include <cstdint>
namespace neurun
{
-namespace internal
+namespace graph
{
namespace operand
{
int32_t offset() const { return _offset; }
private:
- // Now neurun::internal::operand::DataType share same enum value with OperandCode
+ // Now neurun::graph::operand::DataType share same enum value with OperandCode
// in NeuralNetworks.h.
// If we don't share same value, we must fix this mapping function.
DataType typeFromOperandCode(OperandCode type);
int32_t _offset;
};
} // namespace operand
-} // namespace internal
+} // namespace graph
} // namespace neurun
-#endif // __NEURUN_INTERNAL_OPERAND_TYPEINFO_H__
+#endif // __NEURUN_GRAPH_OPERAND_TYPEINFO_H__
void TensorConvertFromCommonLayer::configure(::internal::common::Tensor *inputTensor,
::arm_compute::ICLTensor *outputTensor,
- const ::neurun::internal::operand::Shape &tensorShape)
+ const ::neurun::graph::operand::Shape &tensorShape)
{
_inputTensor = inputTensor;
_outputTensor = outputTensor;
bool convert();
void configure(::internal::common::Tensor *inputTensor, ::arm_compute::ICLTensor *outputTensor,
- const ::neurun::internal::operand::Shape &tensorShape);
+ const ::neurun::graph::operand::Shape &tensorShape);
void run();
::internal::common::Tensor *_inputTensor;
::arm_compute::ICLTensor *_outputTensor;
- ::neurun::internal::operand::Shape _tensorShape{1};
+ ::neurun::graph::operand::Shape _tensorShape{1};
};
} // namespace acl_cl
void TensorConvertToCommonLayer::configure(::arm_compute::ICLTensor *inputTensor,
::internal::common::Tensor *outputTensor,
- const ::neurun::internal::operand::Shape &tensorShape)
+ const ::neurun::graph::operand::Shape &tensorShape)
{
_inputTensor = inputTensor;
_outputTensor = outputTensor;
bool convert();
void configure(::arm_compute::ICLTensor *inputTensor, ::internal::common::Tensor *outputTensor,
- const ::neurun::internal::operand::Shape &tensorShape);
+ const ::neurun::graph::operand::Shape &tensorShape);
void run();
::arm_compute::ICLTensor *_inputTensor;
::internal::common::Tensor *_outputTensor;
- ::neurun::internal::operand::Shape _tensorShape{1};
+ ::neurun::graph::operand::Shape _tensorShape{1};
};
} // namespace acl_cl
return static_cast<int32_t>(std::floor(max_input_rescaled));
}
-Shape getShape(const ::neurun::internal::operand::Object &o)
+Shape getShape(const ::neurun::graph::operand::Object &o)
{
Shape shape;
#include <vector>
#include "tensorflow/contrib/lite/kernels/internal/types.h"
-#include "internal/operand/Object.h"
+#include "graph/operand/Object.h"
namespace neurun
{
int32_t CalculateInputRadius(int input_integer_bits, int input_left_shift);
-Shape getShape(const ::neurun::internal::operand::Object &o);
+Shape getShape(const ::neurun::graph::operand::Object &o);
uint32_t sizeOfData(OperandType type, const std::vector<uint32_t> &dimensions);
{
neurun::graph::operand::Set set;
- ::neurun::internal::operand::Shape shape0{3};
+ ::neurun::graph::operand::Shape shape0{3};
shape0.dim(0) = 1;
shape0.dim(1) = 2;
shape0.dim(2) = 3;
- ::neurun::internal::operand::Shape shape1{4};
+ ::neurun::graph::operand::Shape shape1{4};
shape1.dim(0) = 10;
shape1.dim(1) = 20;
shape1.dim(2) = 30;
shape1.dim(3) = 40;
- ::neurun::internal::operand::TypeInfo type{ANEURALNETWORKS_TENSOR_INT32, 0, 0};
+ ::neurun::graph::operand::TypeInfo type{ANEURALNETWORKS_TENSOR_INT32, 0, 0};
set.append(shape0, type);
set.append(shape1, type);
neurun::graph::Graph graph;
neurun::graph::verifier::DAGChecker verifier;
- neurun::internal::operand::Shape shape{1u};
- neurun::internal::operand::TypeInfo type{ANEURALNETWORKS_TENSOR_INT32, 0, 0};
+ neurun::graph::operand::Shape shape{1u};
+ neurun::graph::operand::TypeInfo type{ANEURALNETWORKS_TENSOR_INT32, 0, 0};
shape.dim(0) = 3;
// Model Input/Output
neurun::graph::Graph graph;
neurun::graph::verifier::DAGChecker verifier;
- neurun::internal::operand::Shape shape{1u};
- neurun::internal::operand::TypeInfo type{ANEURALNETWORKS_TENSOR_INT32, 0, 0};
+ neurun::graph::operand::Shape shape{1u};
+ neurun::graph::operand::TypeInfo type{ANEURALNETWORKS_TENSOR_INT32, 0, 0};
shape.dim(0) = 3;
// Model Input/Output
{
neurun::graph::Graph graph;
- neurun::internal::operand::Shape shape{1u};
- neurun::internal::operand::TypeInfo type{ANEURALNETWORKS_TENSOR_INT32, 0, 0};
+ neurun::graph::operand::Shape shape{1u};
+ neurun::graph::operand::TypeInfo type{ANEURALNETWORKS_TENSOR_INT32, 0, 0};
shape.dim(0) = 3;
// Add Conv
{
neurun::graph::Graph graph;
- neurun::internal::operand::Shape shape{1u};
- neurun::internal::operand::TypeInfo type{ANEURALNETWORKS_TENSOR_INT32, 0, 0};
+ neurun::graph::operand::Shape shape{1u};
+ neurun::graph::operand::TypeInfo type{ANEURALNETWORKS_TENSOR_INT32, 0, 0};
shape.dim(0) = 3;
// Add Concat
neurun::graph::Graph graph;
neurun::graph::verifier::DAGChecker verifier;
- ::neurun::internal::operand::Shape shape{1u};
- ::neurun::internal::operand::TypeInfo type{ANEURALNETWORKS_TENSOR_INT32, 0, 0};
+ ::neurun::graph::operand::Shape shape{1u};
+ ::neurun::graph::operand::TypeInfo type{ANEURALNETWORKS_TENSOR_INT32, 0, 0};
shape.dim(0) = 3;
auto operand1 = graph.addOperand(shape, type);