numpy

package
v0.28.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package numpy allows one to read/write tensors to Python's NumPy npy and npz file formats.

Experimental: this package (numpy) is fresh from the oven and not well tested. Please open an issue if you find any bugs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FortranToCLayout

func FortranToCLayout(dtypeSize int, dims []int, fortranData []byte, cData []byte) error

func FromNpyFile

func FromNpyFile(filePath string) (*tensors.Tensor, error)

FromNpyFile reads a .npy file and returns a tensors.Tensor.

func FromNpyReader

func FromNpyReader(r io.Reader) (*tensors.Tensor, error)

FromNpyReader reads a .npy file from an io.Reader and returns a tensors.Tensor.

func FromNpzFile

func FromNpzFile(filePath string) (map[string]*tensors.Tensor, error)

FromNpzFile reads a .npz file and returns a map of tensor names to tensors.Tensor.

func FromNpzReader

func FromNpzReader(r io.ReaderAt, size int64) (map[string]*tensors.Tensor, error)

FromNpzReader reads a .npz file from an io.ReaderAt and size, returning a map of tensor names to tensors.Tensor. .npz files are zip archives, so we need io.ReaderAt.

func ToNpyFile

func ToNpyFile(tensor *tensors.Tensor, filePath string) error

ToNpyFile serializes a tensors.Tensor to a .npy file.

func ToNpyWriter

func ToNpyWriter(tensor *tensors.Tensor, w io.Writer) error

ToNpyWriter serializes a tensors.Tensor to an io.Writer in .npy format.

func ToNpzFile

func ToNpzFile(tensorsMap map[string]*tensors.Tensor, filePath string) error

ToNpzFile serializes a map of tensors to a .npz file.

func ToNpzWriter

func ToNpzWriter(tensorsMap map[string]*tensors.Tensor, w io.Writer) error

ToNpzWriter serializes a map of tensors to an io.Writer as a .npz archive. Note: Creating a valid zip archive generally requires io.WriterAt for the central directory, which is written at the end. A simple io.Writer is not enough for zip.NewWriter directly if the output needs to be streamed without seeking (e.g., network stream). However, zip.Writer itself buffers and then writes. If 'w' is an os.File, it works. For a generic io.Writer that doesn't support Seek, this would be more complex, potentially requiring writing the entire NPZ to a bytes.Buffer first, then to the writer.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL