Initializers
Initializers
[function] set-manual-seed
(set-manual-seed &key (seed 0))
Sets the seed for random operations.
[macro] with-manual-seed
(with-manual-seed (seed) &body body)
Sets the seed for random operations within the scope of the body.
[function] ax+b
(ax+b shape a b &key (out nil) (dtype *default-float*) (order *default-order*))
Generates an array sampled from this formula: x_i = a * index_components(i) + b.
There is a linspace
function for the same purpose, but it is not lazy.
LazyCATEN-USER> (proceed (ax+b `(3 3) 2 1))
Result
Result{Tensor[float32] :shape (3 3) :id STC203205
((1.0 3.0 5.0)
(7.0 9.0 11.0)
(13.0 15.0 17.0))
:op #<PROCEEDNODE {1002D7B5C3}>
:requires-grad NIL
:variables (STC203115)
:tracker #<TRACKER :order={row(0 1)} :shape=(3 3) :contiguous-p=T>}
StaticCATEN-USER> (linspace `(3 3) 1 0)
Result
Result{Tensor[float32] :shape (3 3) :id TID203206
((0.0 1.0 2.0)
(3.0 4.0 5.0)
(6.0 7.0 8.0))
:op #<ALLOCATE {1002F78B23}>
:requires-grad NIL
:variables NIL
:tracker #<TRACKER :order={row(0 1)} :shape=(3 3) :contiguous-p=T>}
[function] !rand
(!rand shape &key (dtype *default-float*) (order *default-order*) (out nil))
Creates a tensor whose elements are randomly sampled from a uniform distribution over the interval [0, 1)
.
There is a rand
function for the same purpose, but it is not lazy.
LazyCATEN-USER> (proceed (!rand `(3 3)))
Result
Result{Tensor[float32] :shape (3 3) :id STC210745
((0.5561414 0.5751883 0.832701)
(0.7853549 0.37660313 0.84738994)
(0.55430925 0.9354172 0.9739074))
:op #<PROCEEDNODE {1004CB51C3}>
:requires-grad NIL
:variables (STC203277)
:tracker #<TRACKER :order={row(0 1)} :shape=(3 3) :contiguous-p=T>}
StaticCATEN-USER> (rand `(3 3))
Result
Result{Tensor[float32] :shape (3 3) :id TID210746
((0.53696483 0.6626895 0.9899716)
(0.33544847 0.3335809 0.6769852)
(0.041966714 0.015882287 0.753615))
:op #<ALLOCATE {1004CB5AB3}>
:requires-grad NIL
:variables NIL
:tracker #<TRACKER :order={row(0 1)} :shape=(3 3) :contiguous-p=T>}
[function] !normal
(!normal shape &key (mean 0.0) (std 1.0) (dtype *default-float*) (order *default-order*) (out nil))
Creates a tensor whose elements are randomly sampled from a normal distribution with the given mean
and std
.
There is a normal
function for the same purpose, but it is not lazy.
LazyCATEN-USER> (proceed (!normal `(3 3) :mean 0.0 :std 2.0))
Result
Result{Tensor[float32] :shape (3 3) :id STC226682
((0.22197889 -4.817684 0.18407516)
(-1.9114828 -0.43231335 -0.90131146)
(-2.5488627 -0.80741 -1.066406))
:op #<PROCEEDNODE {1003ADF753}>
:requires-grad NIL
:variables (STC210758)
:tracker #<TRACKER :order={row(0 1)} :shape=(3 3) :contiguous-p=T>}
StaticCATEN-USER> (normal `(3 3) :mean 0.0 :std 1.0)
Result
Result{Tensor[float32] :shape (3 3) :id TID226683
((0.20325683 1.9010925 0.11178739)
(0.06818088 0.10441013 0.98638976)
(0.6173678 -1.0524902 -0.3097188))
:op #<ALLOCATE {1003B48413}>
:requires-grad NIL
:variables NIL
:tracker #<TRACKER :order={row(0 1)} :shape=(3 3) :contiguous-p=T>}
[function] !randn
(!randn shape &key (dtype *default-float*) (order *default-order*) (out nil))
Creates a tensor whose elements are randomly sampled from a normal distribution with a mean of 0 and a standard deviation of 1.
There is a randn
function for the same purpose, but it is not lazy.
LazyCATEN-USER> (proceed (!randn `(3 3)))
Result
Result{Tensor[float32] :shape (3 3) :id STC241391
((-1.0663555 -0.2564156 0.08828225)
(2.0705404 -0.094690986 1.1788496)
(-1.4148906 1.0167512 -0.6521854))
:op #<PROCEEDNODE {100195F753}>
:requires-grad NIL
:variables (STC226693)
:tracker #<TRACKER :order={row(0 1)} :shape=(3 3) :contiguous-p=T>}
StaticCATEN-USER> (randn `(3 3))
Result
Result{Tensor[float32] :shape (3 3) :id TID241392
((0.8697504 -2.7880201 1.4020109)
(-0.47702768 0.6844121 -0.68407243)
(1.3354832 -0.36871713 -0.22123063))
:op #<ALLOCATE {10023702C3}>
:requires-grad NIL
:variables NIL
:tracker #<TRACKER :order={row(0 1)} :shape=(3 3) :contiguous-p=T>}
(!uniform shape &key (low 0.0) (high 1.0) (dtype *default-float*) (order *default-order*) (out nil))
Creates a tensor whose elements are randomly sampled from a uniform distribution over the interval [low, high)
There is a uniform
function for the same purpose, but it is not lazy.
LazyCATEN-USER> (proceed (!uniform `(3 3) :low 1.0 :high 2.0))
Result
Result{Tensor[float32] :shape (3 3) :id STC250162
((1.590658 1.0057554 1.2562647)
(1.1458193 1.6777649 1.8310666)
(1.8900917 1.3517946 1.3587387))
:op #<PROCEEDNODE {10045CD1C3}>
:requires-grad NIL
:variables (STC241404)
:tracker #<TRACKER :order={row(0 1)} :shape=(3 3) :contiguous-p=T>}
StaticCATEN-USER> (uniform `(3 3) :low 1.0 :high 2.0)
Result
Result{Tensor[float32] :shape (3 3) :id TID250163
((1.8804288 1.6129477 1.8870113)
(1.0641054 1.7846086 1.8476219)
(1.3157417 1.4555242 1.7016529))
:op #<ALLOCATE {10017C5343}>
:requires-grad NIL
:variables NIL
:tracker #<TRACKER :order={row(0 1)} :shape=(3 3) :contiguous-p=T>}
[function] !randint
(!randint shape &key (low 0) (high 1) (dtype *default-int*) (order *default-order*) (out nil))
Creates a tensor whose elements are randomly sampled from a uniform distribution over the interval [low, high)
.
There is a randint
function for the same purpose, but it is not lazy.
LazyCATEN-USER> (ctx:with-contextvar (:jit 1) (proceed (!randint `(3 3) :low 1 :high 10)))
Result
Result{Tensor[int64] :shape (3 3) :id STC287365
((6 4 4)
(9 3 6)
(9 6 9))
:op #<PROCEEDNODE {100318CD33}>
:requires-grad NIL
:variables (STC257801)
:tracker #<TRACKER :order={row(0 1)} :shape=(3 3) :contiguous-p=T>}
StaticCATEN-USER> (ctx:with-contextvar (:jit 1) (randint `(3 3) :low 1 :high 10 :dtype :int32))
Result
Result{Tensor[int32] :shape (3 3) :id TID287366
((3 6 4)
(8 9 4)
(7 8 6))
:op #<ALLOCATE {1005039D73}>
:requires-grad NIL
:variables NIL
:tracker #<TRACKER :order={row(0 1)} :shape=(3 3) :contiguous-p=T>}
[function] !full
(!full shape fill-value &key (dtype *default-float*) (order *default-order*))
Initializes a tensor filled with fill-value
.
lispCATEN-USER> (proceed (!full `(3 3) (inf)))
Result
Result{Tensor[float32] :shape (3 3) :id STC315261
((#.SB-EXT:SINGLE-FLOAT-POSITIVE-INFINITY #.SB-EXT:SINGLE-FLOAT-POSITIVE-INFINITY #.SB-EXT:SINGLE-FLOAT-POSITIVE-INFINITY)
(#.SB-EXT:SINGLE-FLOAT-POSITIVE-INFINITY #.SB-EXT:SINGLE-FLOAT-POSITIVE-INFINITY #.SB-EXT:SINGLE-FLOAT-POSITIVE-INFINITY)
(#.SB-EXT:SINGLE-FLOAT-POSITIVE-INFINITY #.SB-EXT:SINGLE-FLOAT-POSITIVE-INFINITY #.SB-EXT:SINGLE-FLOAT-POSITIVE-INFINITY))
:op #<PROCEEDNODE {1005051E63}>
:requires-grad NIL
:variables (TID315199)
:tracker #<TRACKER :order={row(0 1)} :shape=(3 3) :contiguous-p=T>}
No description provided
[function] xavier-gaussian
No description provided