Utils
Tsunami provides some utility functions to make your life easier.
Tsunami.accuracy
— Functionaccuracy(ŷ::AbstractMatrix, y)
Compute the classification accuracy of a batch of predictions ŷ
against true labels y
. y
can be either a vector or a matrix. If y
is a vector, it is assumed that the labels are integers in the range 1:K
where K == size(ŷ, 1)
is the number of classes.
Tsunami.seed!
— Functionseed!(seed::Int)
Seed the RNGs of both CPU and GPU.
Tsunami.foreach_trainable
— Functionforeach_trainable(f, x, ys...)
Apply f
to each trainable array in object x
(or x
itself if it is a leaf array) recursing into the children given by Optimisers.trainable
.
ys
are optional additional objects with the same structure as x
. f
will be applied to corresponding elements of x
and ys
.