Example #1
0
 def val_to_typecode(val):
     dtype = dtypes.result_type(val)
     weak_type = dtypes.is_weakly_typed(val)
     typecode = dtype_to_typecode[dtype]
     if weak_type:
         typecode = typecode[:-1] + '*'
     return typecode
Example #2
0
 def testBinaryNonPromotion(self, dtype, weak_type):
     # Regression test for https://github.com/google/jax/issues/6051
     x = lax._convert_element_type(0, dtype, weak_type=weak_type)
     y = (x + x)
     assert x.dtype == y.dtype
     assert dtypes.is_weakly_typed(y) == dtypes.is_weakly_typed(x)