llvm::getTensorSpecFromJSON

Construct a TensorSpec from a JSON dictionary describing the tensor.

Synopsis

Declared in <llvm/Analysis/TensorSpec.h>

std::optional<TensorSpec>
getTensorSpecFromJSON(
    LLVMContext& Ctx,
    json::Value const& Value);

Description

The dictionary has the form: { "name": <string>, "port": <int>, "type": <string. Use LLVM's types, e.g. float, double, int64_t>, "shape": <array of ints> } For the "type" field, see the C++ primitive types used in TFUTILS_SUPPORTED_TYPES.

Return Value

A TensorSpec on success, or std::nullopt if Value is invalid.

Parameters

NameDescription
CtxLLVM context used for diagnostics if the JSON is invalid.
ValueJSON value expected to be a dictionary with name, port, type, and shape fields.