= 1024" x-on:close-sidebar="sidebar=window.innerWidth >= 1024 && true">
package torch
-
torch.core
-
-
torch.toplevel
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
val create : filename:Base.string -> t
create ~filename
reads text file filename
and stores its content in t
. The tensors returned in this module use compact labels: e.g. if filename
use n different characters, the values used in the tensors will range from 0 to n-1.
val iter :
?device:Device.t ->
t ->
f:(Base.int -> xs:Tensor.t -> ys:Tensor.t -> Base.unit) ->
seq_len:Base.int ->
batch_size:Base.int ->
Base.unit
iter t ~f ~seq_len ~batch_size
iterates f
over the whole dataset. f
is given two different tensors xs
and ys
which shapes are both seq_len; batch_size; labels
. ys
is shifted by one compared to xs
. The dataset is shuffled on each call to iter
.
char t ~label
returns the character from the original file that has been mapped to label
.