diff --git a/aidge_core/aidge_export_aidge/operator_export/producer.py b/aidge_core/aidge_export_aidge/operator_export/producer.py index c04019043a6cd7d1a0de95a0ba32f2bb7a3a4bec..d082e9726b7ca33fbe6f4692bf7b55930b69cb9d 100644 --- a/aidge_core/aidge_export_aidge/operator_export/producer.py +++ b/aidge_core/aidge_export_aidge/operator_export/producer.py @@ -1,22 +1,22 @@ from aidge_core.aidge_export_aidge.utils import operator_register from aidge_core.aidge_export_aidge import ROOT_EXPORT -from aidge_core import DataType, ExportNode, generate_file, generate_str +from aidge_core import dtype, ExportNode, generate_file, generate_str import numpy as np from pathlib import Path # Convert aidge datatype to C++ type datatype_converter = { - DataType.Float64 : "double", - DataType.Float32 : "float", - DataType.Float16 : "half_float::half", - DataType.Int8 : "int8_t", - DataType.Int16 : "int16_t", - DataType.Int32 : "int32_t", - DataType.Int64 : "int64_t", - DataType.UInt8 : "uint8_t", - DataType.UInt16 : "uint16_t", - DataType.UInt32 : "uint32_t", - DataType.UInt64 : "uint64_t" + dtype.float64 : "double", + dtype.float32 : "float", + dtype.float16 : "half_float::half", + dtype.int8 : "int8_t", + dtype.int16 : "int16_t", + dtype.int32 : "int32_t", + dtype.int64 : "int64_t", + dtype.uint8 : "uint8_t", + dtype.uint16 : "uint16_t", + dtype.uint32 : "uint32_t", + dtype.uint64 : "uint64_t" } diff --git a/aidge_core/export_utils/node_export.py b/aidge_core/export_utils/node_export.py index 5cafcde634e606fd49d171cce1b354236f5e8364..80c37dd0a54d57561ce1a872ea540461aeec30a0 100644 --- a/aidge_core/export_utils/node_export.py +++ b/aidge_core/export_utils/node_export.py @@ -20,7 +20,7 @@ class ExportNode(ABC): self.node = aidge_node self.operator = aidge_node.get_operator() self.name = self.node.name() - self.attributes = self.operator.attr.dict() # Attributes are auto fetched from aidge operators + self.attributes = self.operator.attr.dict() if self.operator.attr is not None else {} # Attributes are auto fetched from aidge operators # rename is_leaf ? self.is_last = len(self.node.get_children()) == 0 diff --git a/aidge_core/unit_tests/test_tensor.py b/aidge_core/unit_tests/test_tensor.py index 89f8a046a6f5578fccb4fd527ab1c0cc907f7c2b..6348ba8dd1a635ce0299760b6fd31dcef58716cf 100644 --- a/aidge_core/unit_tests/test_tensor.py +++ b/aidge_core/unit_tests/test_tensor.py @@ -42,7 +42,7 @@ class test_tensor(unittest.TestCase): np_array = np.arange(9).reshape(1,1,3,3).astype(np.int32) # Numpy -> Tensor t = aidge_core.Tensor(np_array) - self.assertEqual(t.dtype(), aidge_core.DataType.int32) + self.assertEqual(t.dtype(), aidge_core.dtype.int32) for i_t, i_n in zip(t, np_array.flatten()): self.assertTrue(i_t == i_n) for i,j in zip(t.dims(), np_array.shape): @@ -62,7 +62,7 @@ class test_tensor(unittest.TestCase): np_array = np.arange(9).reshape(1,1,3,3).astype(np.int64) # Numpy -> Tensor t = aidge_core.Tensor(np_array) - self.assertEqual(t.dtype(), aidge_core.DataType.int64) + self.assertEqual(t.dtype(), aidge_core.dtype.int64) for i_t, i_n in zip(t, np_array.flatten()): self.assertTrue(i_t == i_n) for i,j in zip(t.dims(), np_array.shape): @@ -73,7 +73,7 @@ class test_tensor(unittest.TestCase): np_array = np.random.rand(1, 1, 3, 3).astype(np.float32) # Numpy -> Tensor t = aidge_core.Tensor(np_array) - self.assertEqual(t.dtype(), aidge_core.DataType.float32) + self.assertEqual(t.dtype(), aidge_core.dtype.float32) for i_t, i_n in zip(t, np_array.flatten()): self.assertTrue(i_t == i_n) # TODO : May need to change this to a difference for i,j in zip(t.dims(), np_array.shape): diff --git a/python_binding/data/pybind_Data.cpp b/python_binding/data/pybind_Data.cpp index 46bbcf83d3c2b1450e22c76aba01931d3ae4bfe5..c6595360b17ee08eaa82d483987914adc67b60a8 100644 --- a/python_binding/data/pybind_Data.cpp +++ b/python_binding/data/pybind_Data.cpp @@ -10,6 +10,7 @@ ********************************************************************************/ #include <pybind11/pybind11.h> + #include "aidge/data/Data.hpp" namespace py = pybind11; @@ -17,7 +18,7 @@ namespace Aidge { void init_Data(py::module& m){ // TODO : extend with more values ! - py::enum_<DataType>(m, "DataType") + py::enum_<DataType>(m, "dtype") .value("float64", DataType::Float64) .value("float32", DataType::Float32) .value("float16", DataType::Float16) @@ -25,7 +26,7 @@ void init_Data(py::module& m){ .value("int16", DataType::Int16) .value("int32", DataType::Int32) .value("int64", DataType::Int64) - .value("int8", DataType::Int8) + .value("uint8", DataType::UInt8) .value("uint16", DataType::UInt16) .value("uint32", DataType::UInt32) .value("uint64", DataType::UInt64)