TensorData documents and relies on consistency between its bytes, shape, and dtype, but its public fields and raw-byte constructors currently allow safe code to create invalid values.
- Make TensorData fields private and expose appropriate accessors
- Introduce fallible raw-byte constructors
- Ensure deserialization rejects the same invalid representations as fallible raw-byte construction
Somewhat related to #5360 #5316
TensorDatadocuments and relies on consistency between its bytes, shape, and dtype, but its public fields and raw-byte constructors currently allow safe code to create invalid values.Somewhat related to #5360 #5316