3 sys.path.insert(0, os.path.abspath(
"."))
5 cdef extern
from "ctf.hpp" namespace
"CTF_int":
8 cdef extern
from "ctf.hpp" namespace
"CTF":
18 Seed the random tensor generator. 23 Seed for random. Each process has the seed with `seed + get_universe().rank`. 31 Seed the random tensor generator with the same seed in all processes. 40 def random(shape, sp=None, p=None, dtype=None):
42 random(shape, sp=None, p=None, dtype=None) 43 Return random float (in half-open interval [0.0, 1.0)) tensor with specified parameters. Result tensor is from the continuous uniform distribution over the interval. 48 Input tensor with 1-D or 2-D dimensions. If A is 1-D tensor, return a 2-D tensor with A on diagonal. 51 When sp is specified True, the output tensor will be sparse. 54 When sp is True, p specifies the fraction of sparsity for the sparse tensor. 56 dtype: data-type, optional 57 Not supportted in current CTF Python. 67 >>> import ctf.random as random 68 >>> random.random([2, 2]) 69 array([[0.95027513, 0.79755613], 70 [0.27834548, 0.55310684]]) 75 if sp
is None or sp ==
False:
81 A = ctf.tensor(shape, sp=
True)
82 A.fill_sp_random(frac_sp=p)
def random(shape, sp=None, p=None, dtype=None)
void init_rng(int rank)
initialized random number generator