Exemplo n.º 1
0
 def test_uni_gen(self):
     uni = UniformValGen(backend=self.be)
     res = uni.generate(shape=[1, 1])
     assert res.shape == (1, 1)
     out = self.be.empty((1, 1))
     self.be.min(res, axes=None, out=out)
     assert out.asnumpyarray() >= 0.0
     self.be.max(res, axes=None, out=out)
     assert out.asnumpyarray() < 1.0
Exemplo n.º 2
0
 def test_uni_gen(self):
     uni = UniformValGen(backend=self.be)
     res = uni.generate(shape=[1, 1])
     assert res.shape == (1, 1)
     out = self.be.empty((1, 1))
     self.be.min(res, axes=None, out=out)
     assert out.asnumpyarray() >= 0.0
     self.be.max(res, axes=None, out=out)
     assert out.asnumpyarray() < 1.0
Exemplo n.º 3
0
 def test_uni_params(self):
     low = -5.5
     high = 10.2
     uni = UniformValGen(backend=self.be, low=low, high=high)
     assert str(uni) == ("UniformValGen utilizing CPU backend\n\t"
                         "low: {low}, high: {high}".format(low=low,
                                                           high=high))
     res = uni.generate(shape=[4, 4])
     assert res.shape == (4, 4)
     out = self.be.empty((1, 1))
     self.be.min(res, axes=None, out=out)
     assert out.asnumpyarray() >= low
     self.be.max(res, axes=None, out=out)
     assert out.asnumpyarray() < high
Exemplo n.º 4
0
 def test_uni_params(self):
     low = -5.5
     high = 10.2
     uni = UniformValGen(backend=self.be, low=low, high=high)
     assert str(uni) == ("UniformValGen utilizing CPU backend\n\t"
                         "low: {low}, high: {high}".format(low=low,
                                                           high=high))
     res = uni.generate(shape=[4, 4])
     assert res.shape == (4, 4)
     out = self.be.empty((1, 1))
     self.be.min(res, axes=None, out=out)
     assert out.asnumpyarray() >= low
     self.be.max(res, axes=None, out=out)
     assert out.asnumpyarray() < high
Exemplo n.º 5
0
 def test_uni_basics(self):
     uni = UniformValGen(backend=self.be)
     assert str(uni) == ("UniformValGen utilizing CPU backend\n\t"
                         "low: 0.0, high: 1.0")