There are two separate DType enumerations in the codebase:
TensorFlowTypes.DType — the one actually consumed by the tensor-type system: TensorType carries it as its cell type, and every TensorGenerator (getDefaultDTypes) emits it, including the numpy generators (NpArray, and the new NpOnes/NpZeros).
NumpyTypes.DType — a parallel enum with numeric/floatingPoint/precision fields plus canConvertTo(...) and the FIELD_REFERENCE_TO_DTYPE map.
The two overlap heavily (FLOAT32, FLOAT64, INT32, INT64, UNKNOWN, ...). Numpy-producing code reads numpy dtype fields but must emit TensorFlowTypes.DType to interoperate with TensorType, so NumpyTypes.DType is effectively a second source of truth that does not flow into the analysis.
This surfaced while consolidating the numpy method references into NumpyTypes for #539. The dtype side was deliberately left untouched there to keep that change focused.
Suggested direction
Unify on a single DType enum (or have NumpyTypes.DType delegate to / be replaced by TensorFlowTypes.DType), folding in the numpy-specific canConvertTo/precision metadata so there is one authoritative dtype lattice. Worth confirming whether NumpyTypes.DType.'s canConvertTo semantics are used anywhere before collapsing.
There are two separate
DTypeenumerations in the codebase:TensorFlowTypes.DType— the one actually consumed by the tensor-type system:TensorTypecarries it as its cell type, and everyTensorGenerator(getDefaultDTypes) emits it, including the numpy generators (NpArray, and the newNpOnes/NpZeros).NumpyTypes.DType— a parallel enum withnumeric/floatingPoint/precisionfields pluscanConvertTo(...)and theFIELD_REFERENCE_TO_DTYPEmap.The two overlap heavily (
FLOAT32,FLOAT64,INT32,INT64,UNKNOWN, ...). Numpy-producing code reads numpy dtype fields but must emitTensorFlowTypes.DTypeto interoperate withTensorType, soNumpyTypes.DTypeis effectively a second source of truth that does not flow into the analysis.This surfaced while consolidating the numpy method references into
NumpyTypesfor #539. The dtype side was deliberately left untouched there to keep that change focused.Suggested direction
Unify on a single
DTypeenum (or haveNumpyTypes.DTypedelegate to / be replaced byTensorFlowTypes.DType), folding in the numpy-specificcanConvertTo/precision metadata so there is one authoritative dtype lattice. Worth confirming whetherNumpyTypes.DType.'scanConvertTosemantics are used anywhere before collapsing.