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 STC168662
((1.0 3.0 5.0)
(7.0 9.0 11.0)
(13.0 15.0 17.0))
:op #<PROCEEDNODE {1003DB17B3}>
:requires-grad NIL
:variables (STC168572)
: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 TID168663
((0.0 1.0 2.0)
(3.0 4.0 5.0)
(6.0 7.0 8.0))
:op #<ALLOCATE {10040E45D3}>
: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 STC176204
((0.20409577 0.90219986 0.79199487)
(0.2442036 0.96463364 0.51301926)
(0.78693986 0.56747437 0.83507144))
:op #<PROCEEDNODE {1008F5FED3}>
:requires-grad NIL
:variables (STC168734)
: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 TID176205
((0.9249985 0.46999344 0.60219383)
(0.68696326 0.0976631 0.9859982)
(0.5878254 0.10235573 0.24177334))
:op #<ALLOCATE {1008FF87E3}>
: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 STC191558
((-3.5921135 -0.85469407 -0.46488842)
(2.04511 -1.5669986 1.0678742)
(0.21997164 -0.5478315 -3.0454564))
:op #<PROCEEDNODE {1004EFF753}>
:requires-grad NIL
:variables (STC176217)
: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 TID191559
((0.7295724 -0.35026157 0.76988196)
(-0.3720482 1.6982456 -0.5741514)
(0.24479412 1.3892574 -1.5368292))
:op #<ALLOCATE {10050E84B3}>
: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 STC205718
((-0.56355345 -0.40396473 0.666639)
(1.8203461 -0.12316344 0.8386954)
(-1.3675435 -0.05577714 -0.4770648))
:op #<PROCEEDNODE {1002EEF753}>
:requires-grad NIL
:variables (STC191569)
: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 TID205719
((-1.6468598 -0.28877127 1.1164823)
(0.4265208 -2.4924476 -0.6791966)
(-0.4103133 0.3206808 0.34030145))
:op #<ALLOCATE {1003040453}>
: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 STC214456
((1.386548 1.3390925 1.3670914)
(1.8147879 1.1661164 1.1971163)
(1.5403535 1.4768131 1.8832853))
:op #<PROCEEDNODE {100564F403}>
:requires-grad NIL
:variables (STC205731)
: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 TID214457
((1.4487232 1.5480319 1.6024172)
(1.1562546 1.5229615 1.2909594)
(1.5516578 1.7488751 1.3713456))
:op #<ALLOCATE {1002A1A4F3}>
: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 STC260497
((4 8 4)
(5 4 9)
(8 1 8))
:op #<PROCEEDNODE {1001BB8403}>
:requires-grad NIL
:variables (STC222098)
: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 TID260498
((5 7 2)
(5 3 9)
(2 2 6))
:op #<ALLOCATE {10053C0F73}>
: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 STC297530
((#.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 {10053E0983}>
:requires-grad NIL
:variables (TID297468)
:tracker #<TRACKER :order={row(0 1)} :shape=(3 3) :contiguous-p=T>}
No description provided
[function] xavier-gaussian
No description provided