TensorFlow data types are each associated with a Scala type (e.g., FLOAT64 with Double). It thus may be better to generify the data type trait using the associated Scala type. FLOAT64 would then extend DataType[Double]. The issue that's preventing this from happening right now is that when we create an op output, we obtain the integer field representing its data type from the C API at runtime. It is thus currently impossible to avoid using existential types (i.e., DataType[_]), which makes the use of generic data types redundant.
TensorFlow data types are each associated with a Scala type (e.g.,
FLOAT64
withDouble
). It thus may be better to generify the data type trait using the associated Scala type.FLOAT64
would then extendDataType[Double]
. The issue that's preventing this from happening right now is that when we create an op output, we obtain the integer field representing its data type from the C API at runtime. It is thus currently impossible to avoid using existential types (i.e.,DataType[_]
), which makes the use of generic data types redundant.