Skip to content

io

File reading and writing for point cloud data: JSON, OFF meshes, and safetensors.

Functions:

  • load_json –

    Read a JSON file.

  • load_off –

    Read an OFF mesh, triangulating its quadrilateral faces.

  • save_safetensors –

    Write a mapping to a safetensors file, storing its string entries as metadata.

  • load_safetensors –

    Read a safetensors file, merging its metadata back into the tensor mapping.

load_json

load_json(file_path: PathLike) -> Dict[str, Any]

Read a JSON file.

Parameters:

  • file_path (PathLike) –

    Path to the JSON file.

Returns:

  • Dict[str, Any] –

    The decoded JSON object.

load_off

load_off(file_path: PathLike) -> Tuple[ndarray, ndarray]

Read an OFF mesh, triangulating its quadrilateral faces.

Parameters:

  • file_path (PathLike) –

    Path to the OFF file.

Returns:

  • Tuple[ndarray, ndarray] –

    The vertices \((V, 3)\) and the triangle indices \((F, 3)\).

save_safetensors

save_safetensors(
    file_path: PathLike, data: Mapping[str, Any]
) -> None

Write a mapping to a safetensors file, storing its string entries as metadata.

Parameters:

  • file_path (PathLike) –

    Path to the safetensors file to write.

  • data (Mapping[str, Any]) –

    Mapping of names to tensors, scalars (wrapped in a tensor) or strings.

load_safetensors

load_safetensors(
    file_path: PathLike,
) -> Dict[str, Tensor | str]

Read a safetensors file, merging its metadata back into the tensor mapping.

Parameters:

  • file_path (PathLike) –

    Path to the safetensors file.

Returns:

  • Dict[str, Tensor | str] –

    The file's tensors and string metadata, keyed by name.