Skip to content

sgns::neoswarm::core::TensorInterpreter

Converts raw MNN tensor output bytes to a human-readable string. More...

#include <tensor_interpreter.hpp>

Public Functions

Name
TensorInterpreter() =default
~TensorInterpreter() =default
void SetTokenizer(std::shared_ptr< Tokenizer > tok)
Attach a tokenizer for token-decoding mode (optional).
outcome::result< std::string > Interpret(const std::vector< uint8_t > & bytes, sgns::InputFormat format) const
Convert raw tensor bytes to a human-readable string.

Detailed Description

class sgns::neoswarm::core::TensorInterpreter;

Converts raw MNN tensor output bytes to a human-readable string.

Supported formats: FLOAT32, FLOAT16, INT32, INT8. When a Tokenizer is attached and the format is FLOAT32, the bytes are treated as a logit vector and the highest-probability token is decoded.

Public Functions Documentation

function TensorInterpreter

TensorInterpreter() =default

function ~TensorInterpreter

~TensorInterpreter() =default

function SetTokenizer

void SetTokenizer(
    std::shared_ptr< Tokenizer > tok
)

Attach a tokenizer for token-decoding mode (optional).

Parameters:

function Interpret

outcome::result< std::string > Interpret(
    const std::vector< uint8_t > & bytes,
    sgns::InputFormat format
) const

Convert raw tensor bytes to a human-readable string.

Parameters:

  • bytes Raw output bytes from SGProcessingManager.
  • format Tensor element format.

Return: Decoded string or InferenceFailed / InvalidArgument.


Updated on 2026-10-09 at 03:59:42 +0000