forked from M-Labs/artiq
compiler: stop using deprecated numpy.float
This commit is contained in:
parent
ae137d1c9e
commit
9741e4aa43
|
@ -167,10 +167,10 @@ class ASTSynthesizer:
|
||||||
coerced = bool(value)
|
coerced = bool(value)
|
||||||
return asttyped.NameConstantT(value=coerced, type=typ,
|
return asttyped.NameConstantT(value=coerced, type=typ,
|
||||||
loc=self._add(repr(coerced)))
|
loc=self._add(repr(coerced)))
|
||||||
elif value is numpy.float:
|
elif value is float:
|
||||||
typ = builtins.fn_float()
|
typ = builtins.fn_float()
|
||||||
return asttyped.NameConstantT(value=None, type=typ,
|
return asttyped.NameConstantT(value=None, type=typ,
|
||||||
loc=self._add("numpy.float"))
|
loc=self._add("float"))
|
||||||
elif value is numpy.int32:
|
elif value is numpy.int32:
|
||||||
typ = builtins.fn_int32()
|
typ = builtins.fn_int32()
|
||||||
return asttyped.NameConstantT(value=None, type=typ,
|
return asttyped.NameConstantT(value=None, type=typ,
|
||||||
|
|
|
@ -72,13 +72,13 @@ class CompareHostDeviceTest(ExperimentCase):
|
||||||
# randomised tests instead.
|
# randomised tests instead.
|
||||||
# TODO: Provoke overflows, division by zero, etc., and compare results.
|
# TODO: Provoke overflows, division by zero, etc., and compare results.
|
||||||
args = [(typ(a), typ(b)) for a, b in [(0, 1), (3, 2), (11, 6)]
|
args = [(typ(a), typ(b)) for a, b in [(0, 1), (3, 2), (11, 6)]
|
||||||
for typ in [numpy.int32, numpy.int64, numpy.float]]
|
for typ in [numpy.int32, numpy.int64, numpy.float64]]
|
||||||
for op in ELEM_WISE_BINOPS:
|
for op in ELEM_WISE_BINOPS:
|
||||||
for arg in args:
|
for arg in args:
|
||||||
self._test_binop("a" + op + "b", *arg)
|
self._test_binop("a" + op + "b", *arg)
|
||||||
|
|
||||||
def test_scalar_matrix_binops(self):
|
def test_scalar_matrix_binops(self):
|
||||||
for typ in [numpy.int32, numpy.int64, numpy.float]:
|
for typ in [numpy.int32, numpy.int64, numpy.float64]:
|
||||||
scalar = typ(3)
|
scalar = typ(3)
|
||||||
matrix = numpy.array([[4, 5, 6], [7, 8, 9]], dtype=typ)
|
matrix = numpy.array([[4, 5, 6], [7, 8, 9]], dtype=typ)
|
||||||
for op in ELEM_WISE_BINOPS:
|
for op in ELEM_WISE_BINOPS:
|
||||||
|
@ -88,7 +88,7 @@ class CompareHostDeviceTest(ExperimentCase):
|
||||||
self._test_binop(code, matrix, matrix)
|
self._test_binop(code, matrix, matrix)
|
||||||
|
|
||||||
def test_matrix_mult(self):
|
def test_matrix_mult(self):
|
||||||
for typ in [numpy.int32, numpy.int64, numpy.float]:
|
for typ in [numpy.int32, numpy.int64, numpy.float64]:
|
||||||
mat_a = numpy.array([[1, 2, 3], [4, 5, 6]], dtype=typ)
|
mat_a = numpy.array([[1, 2, 3], [4, 5, 6]], dtype=typ)
|
||||||
mat_b = numpy.array([[7, 8], [9, 10], [11, 12]], dtype=typ)
|
mat_b = numpy.array([[7, 8], [9, 10], [11, 12]], dtype=typ)
|
||||||
self._test_binop("a @ b", mat_a, mat_b)
|
self._test_binop("a @ b", mat_a, mat_b)
|
||||||
|
@ -139,7 +139,7 @@ class _MatrixMult(EnvExperiment):
|
||||||
def build(self):
|
def build(self):
|
||||||
self.setattr_device("core")
|
self.setattr_device("core")
|
||||||
self.imat = numpy.arange(4, dtype=numpy.int64).reshape((2, 2))
|
self.imat = numpy.arange(4, dtype=numpy.int64).reshape((2, 2))
|
||||||
self.fmat = numpy.arange(4, dtype=numpy.float).reshape((2, 2))
|
self.fmat = numpy.arange(4, dtype=numpy.float64).reshape((2, 2))
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
Loading…
Reference in New Issue