Skip to content
  • Taylor Cramer's avatar
    Clarify error message following failed value serialization · 09b14dc9
    Taylor Cramer authored
    Previously, we relied on numpy to provide helpful error messages in the case where the provided value did not match the required dtype. However, this resulted in somewhat unfriendly error messages such as the following (in the case where an int64 tensor was expected but a tf.data.Dataset was provided):
    
    TypeError: Cannot cast scalar from dtype('O') to dtype('int64') according to the rule 'same_kind'
    
    The additional context provided by this error message (the value being serialized, the Python type of the value being serialized, and the desired TFF TensorType) should help users find and correct errors more easily.
    
    PiperOrigin-RevId: 411833481
    09b14dc9