def test_promote(): from blaze.expr.graph import IntNode, FloatNode # ---------------------------------- x,y = IntNode(1), FloatNode(1.) res = promote(x,y) # TODO: check if this is platform specific assert res == blaze.float64 # ---------------------------------- x,y = IntNode(1), IntNode(1) res = promote(x,y) assert res == blaze.int32
def test_promote(): from blaze.expr.graph import IntNode, FloatNode # ---------------------------------- x,y = IntNode(1), FloatNode(1.) res = promote(x,y) ## TODO: check if this is platform specific assert res == blaze.float64 ## ---------------------------------- x,y = IntNode(1), IntNode(1) res = promote(x,y) assert res == blaze.int32 # ---------------------------------- x = NDArray([1,2,3], dshape('3, int32')) y = NDArray([1,2,3], dshape('3, int32')) res = promote(x,y) assert res == blaze.int32
def test_promote(): from blaze.expr.graph import IntNode, FloatNode # ---------------------------------- x, y = IntNode(1), FloatNode(1.) res = promote(x, y) ## TODO: check if this is platform specific assert res == blaze.float64 ## ---------------------------------- x, y = IntNode(1), IntNode(1) res = promote(x, y) assert res == blaze.int32 # ---------------------------------- x = NDArray([1, 2, 3], dshape('3, int32')) y = NDArray([1, 2, 3], dshape('3, int32')) res = promote(x, y) assert res == blaze.int32
def simple_type(self): """ If possible determine the datashape before we even hit eval(). This is possible only for simple types. Possible:: 2, 2, int32 Example Not Possible:: X, 2, int32 """ # Get the the simple types for each of the operands. if not all(coretypes.is_simple(op.simple_type()) for op in self.operands if op is not None): raise NotSimple() else: return coretypes.promote(*self.operands)
def simple_type(self): """ If possible determine the datashape before we even hit eval(). This is possible only for simple types. Possible:: 2, 2, int32 Example Not Possible:: X, 2, int32 """ # Get the the simple types for each of the operands. if not all( coretypes.is_simple(op.simple_type()) for op in self.operands if op is not None): raise NotSimple() else: return coretypes.promote(*self.operands)