52
52
#define DALI_REGISTER_TYPE_IMPL (...)
53
53
#endif
54
54
55
+ inline std::string to_string (daliDataType_t dtype);
56
+ inline std::ostream &operator <<(std::ostream &, daliDataType_t dtype);
57
+
55
58
namespace dali {
56
59
57
60
class TensorLayout ;
@@ -90,9 +93,6 @@ inline Copier GetCopier() {
90
93
91
94
using DALIDataType = daliDataType_t;
92
95
93
- inline std::string to_string (DALIDataType dtype);
94
- inline std::ostream &operator <<(std::ostream &, DALIDataType dtype);
95
-
96
96
constexpr auto GetBuiltinTypeName = daliDataTypeName;
97
97
constexpr auto IsFloatingPoint = daliDataTypeIsFloatingPoint;
98
98
constexpr auto IsIntegral = daliDataTypeIsIntegral;
@@ -412,14 +412,6 @@ inline std::string_view TypeName(DALIDataType dtype) {
412
412
return " <unknown>" ;
413
413
}
414
414
415
- inline std::string to_string (DALIDataType dtype) {
416
- std::string_view name = TypeName (dtype);
417
- if (name == " <unknown>" )
418
- return " unknown type: " + std::to_string (static_cast <int >(dtype));
419
- else
420
- return std::string (name);
421
- }
422
-
423
415
// Used to define a type for use in dali. Inserts the type into the
424
416
// TypeTable w/ a unique id and creates a method to get the name of
425
417
// the type as a string. This does not work for non-fundamental types,
@@ -465,8 +457,22 @@ DALI_REGISTER_TYPE(std::vector<float>, DALI_FLOAT_VEC);
465
457
DALI_REGISTER_TYPE (std::vector<TensorLayout>, DALI_TENSOR_LAYOUT_VEC);
466
458
DALI_REGISTER_TYPE (std::vector<DALIDataType>, DALI_DATA_TYPE_VEC);
467
459
468
- inline std::ostream &operator <<(std::ostream &os, DALIDataType dtype) {
469
- std::string_view name = TypeName (dtype);
460
+ #define DALI_INTEGRAL_TYPES uint8_t , int8_t , uint16_t , int16_t , uint32_t , int32_t , uint64_t , int64_t
461
+ #define DALI_NUMERIC_TYPES DALI_INTEGRAL_TYPES, float , double
462
+ #define DALI_NUMERIC_TYPES_FP16 DALI_NUMERIC_TYPES, float16
463
+
464
+ } // namespace dali
465
+
466
+ inline std::string to_string (daliDataType_t dtype) {
467
+ std::string_view name = dali::TypeName (dtype);
468
+ if (name == " <unknown>" )
469
+ return " unknown type: " + std::to_string (static_cast <int >(dtype));
470
+ else
471
+ return std::string (name);
472
+ }
473
+
474
+ inline std::ostream &operator <<(std::ostream &os, daliDataType_t dtype) {
475
+ std::string_view name = dali::TypeName (dtype);
470
476
if (name == " <unknown>" ) {
471
477
// Use string concatenation so that the result is the same as in to_string, unaffected by
472
478
// formatting & other settings in `os`.
@@ -476,10 +482,5 @@ inline std::ostream &operator<<(std::ostream &os, DALIDataType dtype) {
476
482
}
477
483
}
478
484
479
- #define DALI_INTEGRAL_TYPES uint8_t , int8_t , uint16_t , int16_t , uint32_t , int32_t , uint64_t , int64_t
480
- #define DALI_NUMERIC_TYPES DALI_INTEGRAL_TYPES, float , double
481
- #define DALI_NUMERIC_TYPES_FP16 DALI_NUMERIC_TYPES, float16
482
-
483
- } // namespace dali
484
485
485
486
#endif // DALI_PIPELINE_DATA_TYPES_H_
0 commit comments