Module Ptree.Dict

type fields = (string * t) list

The type for dict fields.

val fields_exn : ?ctx:string -> t -> fields

fields_exn ?ctx t is t's fields.

Raises Invalid_argument if t is not Dict _. The optional ctx is prefixed to the error message.

val find : string -> fields -> t option

find name fields is Some v if name is bound in fields, and None otherwise.

val find_exn : ?ctx:string -> string -> fields -> t

find_exn ?ctx name fields is name's value in fields.

Raises Invalid_argument if name is missing. The optional ctx is prefixed to the error message.

val get_tensor_exn : fields -> name:string -> ('a, 'l) Nx_core.Dtype.t -> ('a, 'l) Nx.t

get_tensor_exn fields ~name dtype is the typed tensor in fields under name.

Raises Invalid_argument if name is missing, name is not a tensor, or the tensor dtype differs from dtype.