예제 #1
0
 def class_op(x, y):
     result = op(_DoubleDouble(x), _DoubleDouble(y))
     if isinstance(result, _DoubleDouble):
         result = result.to_array()
     return result
예제 #2
0
 def testClassInstantiation(self, dtype, val):
     dtype = dtypes.canonicalize_dtype(dtype).type
     self.assertEqual(dtype(val), _DoubleDouble(val, dtype).to_array())
예제 #3
0
 def testClassUnaryOp(self, dtype, shape, op):
     rng = jtu.rand_default(self.rng())
     args = (rng(shape, dtype), )
     class_op = lambda x: op(_DoubleDouble(x)).to_array()
     self.assertAllClose(op(*args), class_op(*args))
예제 #4
0
 def testClassInstantiation(self, dtype, val):
     dtype = jnp.dtype(dtype).type
     self.assertEqual(dtype(val), _DoubleDouble(val, dtype).to_array())