コード例 #1
0
 def uniform(self, low=0.0, high=1.0, size=None):
     if size is None:
         tsr = ctf.empty(1)
         tsr.fill_random(low, high)
         return tsr[0]
     else:
         tsr = ctf.empty(size)
         tsr.fill_random(low, high)
         return CTFTensor(tsr)
コード例 #2
0
 def test_empty(self):
     a1 = ctf.empty((2, 3, 4))
     a1 = ctf.empty((2, 3, 4), dtype=numpy.complex128)
     a1 = ctf.empty_like(a1)
     self.assertTrue(a1.dtype == numpy.complex128)
コード例 #3
0
ファイル: test_base.py プロジェクト: solomonik/ctf
 def test_empty(self):
     a1 = ctf.empty((2,3,4))
     a1 = ctf.empty((2,3,4), dtype=numpy.complex128)
     a1 = ctf.empty_like(a1)
     self.assertTrue(a1.dtype == numpy.complex128)
コード例 #4
0
 def empty(self, shape, dtype=float):
     return self.tensor(ctf.empty(shape, dtype=dtype))