mirror of https://github.com/m-labs/artiq.git
compiler: stop using deprecated numpy.float
This commit is contained in:
parent
ae137d1c9e
commit
9741e4aa43
|
@ -167,10 +167,10 @@ class ASTSynthesizer:
|
|||
coerced = bool(value)
|
||||
return asttyped.NameConstantT(value=coerced, type=typ,
|
||||
loc=self._add(repr(coerced)))
|
||||
elif value is numpy.float:
|
||||
elif value is float:
|
||||
typ = builtins.fn_float()
|
||||
return asttyped.NameConstantT(value=None, type=typ,
|
||||
loc=self._add("numpy.float"))
|
||||
loc=self._add("float"))
|
||||
elif value is numpy.int32:
|
||||
typ = builtins.fn_int32()
|
||||
return asttyped.NameConstantT(value=None, type=typ,
|
||||
|
|
|
@ -72,13 +72,13 @@ class CompareHostDeviceTest(ExperimentCase):
|
|||
# randomised tests instead.
|
||||
# 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)]
|
||||
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 arg in args:
|
||||
self._test_binop("a" + op + "b", *arg)
|
||||
|
||||
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)
|
||||
matrix = numpy.array([[4, 5, 6], [7, 8, 9]], dtype=typ)
|
||||
for op in ELEM_WISE_BINOPS:
|
||||
|
@ -88,7 +88,7 @@ class CompareHostDeviceTest(ExperimentCase):
|
|||
self._test_binop(code, matrix, matrix)
|
||||
|
||||
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_b = numpy.array([[7, 8], [9, 10], [11, 12]], dtype=typ)
|
||||
self._test_binop("a @ b", mat_a, mat_b)
|
||||
|
@ -139,7 +139,7 @@ class _MatrixMult(EnvExperiment):
|
|||
def build(self):
|
||||
self.setattr_device("core")
|
||||
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
|
||||
def run(self):
|
||||
|
|
Loading…
Reference in New Issue