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 STC437918
((1.0 3.0 5.0)
(7.0 9.0 11.0)
(13.0 15.0 17.0))
:op #<PROCEEDNODE {100469EB03}>
:requires-grad NIL
:variables (STC437917)}
StaticCATEN-USER> (linspace `(3 3) 1 0)
Result
Result{Tensor[float32] :shape (3 3) :id TID437919
((0.0 1.0 2.0)
(3.0 4.0 5.0)
(6.0 7.0 8.0))
:op #<ALLOCATE {100552A473}>
:requires-grad NIL
:variables NIL}
[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 STC457248
((0.20409577 0.90219986 0.79199487)
(0.2442036 0.96463364 0.51301926)
(0.78693986 0.56747437 0.83507144))
:op #<PROCEEDNODE {100730C4F3}>
:requires-grad NIL
:variables (STC457247)}
StaticCATEN-USER> (rand `(3 3))
Result
Result{Tensor[float32] :shape (3 3) :id TID457249
((0.9249985 0.46999344 0.60219383)
(0.68696326 0.0976631 0.9859982)
(0.5878254 0.10235573 0.24177334))
:op #<ALLOCATE {100730CA23}>
:requires-grad NIL
:variables NIL}
[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 STC509386
((-3.5921135 -0.85469407 -0.46488842)
(2.04511 -1.5669986 1.0678742)
(0.21997164 -0.5478315 -3.0454564))
:op #<PROCEEDNODE {1005949F63}>
:requires-grad NIL
:variables (STC509385)}
StaticCATEN-USER> (normal `(3 3) :mean 0.0 :std 1.0)
Result
Result{Tensor[float32] :shape (3 3) :id TID509387
((0.72957236 0.71980345 0.7698819)
(-0.37204823 1.6982456 -0.57415146)
(0.24479401 1.3892573 -1.536829))
:op #<ALLOCATE {100594A903}>
:requires-grad NIL
:variables NIL}
[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 STC555219
((-0.56355345 -0.40396473 0.666639)
(1.8203461 -0.12316344 0.8386954)
(-1.3675435 -0.05577714 -0.4770648))
:op #<PROCEEDNODE {100847C4F3}>
:requires-grad NIL
:variables (STC555218)}
StaticCATEN-USER> (randn `(3 3))
Result
Result{Tensor[float32] :shape (3 3) :id TID555220
((-1.6468598 -0.28877127 1.1164823)
(0.4265208 -2.4924476 -0.6791966)
(-0.4103133 0.3206808 0.34030145))
:op #<ALLOCATE {100847CA23}>
:requires-grad NIL
:variables NIL}
(!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 STC585713
((1.386548 1.3390925 1.3670914)
(1.8147879 1.1661164 1.1971163)
(1.5403535 1.4768131 1.8832853))
:op #<PROCEEDNODE {1005DB44F3}>
:requires-grad NIL
:variables (STC585712)}
StaticCATEN-USER> (uniform `(3 3) :low 1.0 :high 2.0)
Result
Result{Tensor[float32] :shape (3 3) :id TID585714
((1.4487232 1.5480319 1.6024172)
(1.1562546 1.5229615 1.2909594)
(1.5516578 1.7488751 1.3713456))
:op #<ALLOCATE {100807B803}>
:requires-grad NIL
:variables NIL}
[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[int32] :shape (3 3) :id STC646923
((4 8 4)
(5 4 9)
(8 1 8))
:op #<PROCEEDNODE {1008064EB3}>
:requires-grad NIL
:variables (STC646922)}
StaticCATEN-USER> (ctx:with-contextvar (:jit 1) (randint `(3 3) :low 1 :high 10 :dtype :int32))
Result
Result{Tensor[int32] :shape (3 3) :id TID646924
((5 7 2)
(5 3 9)
(2 2 6))
:op #<ALLOCATE {10059BA893}>
:requires-grad NIL
:variables NIL}
[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 STC678836
((#.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 {10059BF7D3}>
:requires-grad NIL
:variables (STC678835)}
No description provided
[function] xavier-gaussian
No description provided