Procs
proc read_hdf5[T: SomeNumber](h5f: var H5FileObj; name, group = ""; number = -1): Tensor[ T] {.noinit, inline.}
- wrapper around the real read_hdf5 to provide a nicer interface without having to worry about some and none Source Edit
proc read_hdf5[T: SomeNumber](h5f: var H5FileObj; name, group: Option[string]; number: Option[int]): Tensor[T] {.noinit.}
-
Reads a .h5 file (written by arraymancer) and returns a tensor of the specified type. If the tensor is stored in a different type in the file, it will be converted.
Input:
- The H5 file object we read from
- A non-generic name of the tensor to read
- A group different from the root group in which tensor is stored
- if generic names are used the number-th tensor to read
Output:
- A tensor
proc write_hdf5[T: SomeNumber](h5f: var H5FileObj; t: Tensor[T]; name, group: Option[string])
-
Exports a tensor to a hdf5 file To keep this a simple convenience proc, the tensor is stored in the root group of the hdf5 file under a generic name. If the name argument is given, the tensor is stored under this name instead. If the group argument is given the tensor is stored in that group instead of the root group. Note: if no name is given, we need to visit the whole file to check for existing tensors. This will introduce a small overhead!
Input:
- The tensor to write
- The H5 file object we write to
- An optional name for the dataset of the tensor in the file Useful to store multiple tensors in a single HDF5 file
- An optional name for a group to store the tensor in
proc write_hdf5[T: SomeNumber](h5f: var H5FileObj; t: Tensor[T]; name, group = "") {.inline.}
- wrapper around the real write_hdf5 to provide a nicer interface without having to worry about some and none Source Edit
proc write_hdf5[T: SomeNumber](t: Tensor[T]; hdf5Path: string; name, group = "") {. inline.}
- convenience wrapper around write_hdf5 with var H5DataSet argument. opens the given H5 file for writing and then calls the write proc Source Edit