Skip to content

gsf

Classes

Name
class gsf::bf16
struct gsf::graph_outputs
Holds a list of tensors and fixed point scales.
struct gsf::image_parameters
Describes the vx_image.
struct gsf::kernel_arg
Describes a kernel argument.
class gsf::tensor_details
Optionally owns a vx_tensor and provides extended access.
struct gsf::tensor_info
Holds metadata about a tensor.

Functions

Name
template <typename T >
vx_reference
as_vx_reference(T t)
Represents the type as a vx_reference.
void ReleaseArgReferences(std::vector< kernel_arg > & refs)
Releases the references in the vector.
vx_uint32 determineNumGraphParameters(vx_graph graph)
Determine the number of parameters the graph has.
image_parameters GetImageDetails(vx_image image)
Extract the image format and size.
blaize::vx::Node CreateCustomNode(vx_graph graph, const std::vector< vx_tensor > & outputs, const std::vector< vx_tensor > & inputs, const std::vector< vx_scalar > & scalars, const std::vector< std::string > & name, const std::string & node_name)
Creates a graph node from a custom kernel.
blaize::vx::Node CreateCustomNode(vx_graph graph, const std::vector< vx_tensor > & outputs, const std::vector< vx_image > & inputs, const std::vector< vx_scalar > & scalars, const std::vector< std::string > & name, const std::string & node_name)
Creates a graph node from a custom kernel.
blaize::vx::Node CreateCustomNode(vx_graph graph, const std::vector< kernel_arg > & params, const std::vector< std::string > & name, const std::string & node_name)
Creates a graph node from a custom kernel.
blaize::vx::Node CreateCustomNode(vx_graph graph, const std::vector< kernel_arg > & params, vx_kernel kernel, const std::string & node_name)
Creates a graph node from a custom kernel.
blaize::vx::Kernel CreateKernel(vx_context context, const std::string & kernel_name, const std::string & kernel_src, bool is_src =false)
Creates a vx_kernel from a file or a string.
template <typename T >
blaize::vx::Unique< T >
extractParameter(vx_graph graph, vx_uint32 index)
Extract the nth parameter of the graph as a T.
template <typename T >
blaize::vx::Unique< T >
extractParameter(vx_node node, vx_uint32 index)
Extract the nth parameter of the node as a T.
template <typename T >
vx_status
FillTensor(vx_tensor tensor, T value)
This fills the given tensor with values of type T vxCopyTensorPatch is on a more optimal path than vxFillTensorPatch, which is why fill is processed in this manner.
int determine_num_inputs(vx_graph graph, vx_uint32 num_params)
Determines the number of times the input tensor is passed to the graph.
std::vector< uint8_t > to_float(const std::vector< uint8_t > & in, int data_type, float scale)
Convert the raw data in 'in' to a floating point representation.
graph_outputs find_output_tensors(std::vector< tensor_details > outputs, const int * out_scales, size_t scales_size)
Removes tensor views from output and replaces with parent view.

Attributes

Name
constexpr auto VX_GSF_IMAGE_F32
This is an image format extension.

Functions Documentation

function as_vx_reference

template <typename T >
vx_reference as_vx_reference(
    T t
)

Represents the type as a vx_reference.

Parameters:

  • t The value

Template Parameters:

  • T The type to convert

Return: The type as a vx_reference

function ReleaseArgReferences

void ReleaseArgReferences(
    std::vector< kernel_arg > & refs
)

Releases the references in the vector.

Parameters:

  • refs - The list of references

function determineNumGraphParameters

vx_uint32 determineNumGraphParameters(
    vx_graph graph
)

Determine the number of parameters the graph has.

Parameters:

  • graph

Return: The number of parameters

function GetImageDetails

image_parameters GetImageDetails(
    vx_image image
)

Extract the image format and size.

Parameters:

  • image

Return: An image parameters structure providing info about the image

function CreateCustomNode

blaize::vx::Node CreateCustomNode(
    vx_graph graph,
    const std::vector< vx_tensor > & outputs,
    const std::vector< vx_tensor > & inputs,
    const std::vector< vx_scalar > & scalars,
    const std::vector< std::string > & name,
    const std::string & node_name
)

Creates a graph node from a custom kernel.

Parameters:

  • graph
  • outputs The tensor outputs
  • inputs The tensor inputs
  • scalars Any scalars
  • name The kernel name and path to source
  • node_name The name of the node

Return: The created node, owned by the caller

function CreateCustomNode

blaize::vx::Node CreateCustomNode(
    vx_graph graph,
    const std::vector< vx_tensor > & outputs,
    const std::vector< vx_image > & inputs,
    const std::vector< vx_scalar > & scalars,
    const std::vector< std::string > & name,
    const std::string & node_name
)

Creates a graph node from a custom kernel.

Parameters:

  • graph
  • outputs The tensor outputs
  • inputs The image inputs
  • scalars Any scalars
  • name The kernel name and path to source
  • node_name The name of the node

Return: The created node, owned by the caller

function CreateCustomNode

blaize::vx::Node CreateCustomNode(
    vx_graph graph,
    const std::vector< kernel_arg > & params,
    const std::vector< std::string > & name,
    const std::string & node_name
)

Creates a graph node from a custom kernel.

Parameters:

  • graph
  • params All of the parameters
  • name The kernel name and path to source
  • node_name The name of the node

Return: The created node, owned by the caller

function CreateCustomNode

blaize::vx::Node CreateCustomNode(
    vx_graph graph,
    const std::vector< kernel_arg > & params,
    vx_kernel kernel,
    const std::string & node_name
)

Creates a graph node from a custom kernel.

Parameters:

  • graph
  • params All of the parameters
  • kernel The actual kernel
  • node_name The name of the node

Return: The created node, owned by the caller

function CreateKernel

blaize::vx::Kernel CreateKernel(
    vx_context context,
    const std::string & kernel_name,
    const std::string & kernel_src,
    bool is_src =false
)

Creates a vx_kernel from a file or a string.

Parameters:

  • context
  • kernel_name
  • kernel_src - If is_src is true this is the kernel source else its filename
  • is_src

Return: The created kernel, owned by the caller

function extractParameter

template <typename T >
blaize::vx::Unique< T > extractParameter(
    vx_graph graph,
    vx_uint32 index
)

Extract the nth parameter of the graph as a T.

Parameters:

  • graph
  • index

Template Parameters:

  • T the type to extract

Return: The extracted type, owned by the caller

function extractParameter

template <typename T >
blaize::vx::Unique< T > extractParameter(
    vx_node node,
    vx_uint32 index
)

Extract the nth parameter of the node as a T.

Parameters:

  • node
  • index

Template Parameters:

  • T the type to extract

Return: The extracted type, owned by the caller

function FillTensor

template <typename T >
vx_status FillTensor(
    vx_tensor tensor,
    T value
)

This fills the given tensor with values of type T vxCopyTensorPatch is on a more optimal path than vxFillTensorPatch, which is why fill is processed in this manner.

Parameters:

  • tensor
  • value

Template Parameters:

  • T

Return: VX_SUCCESS or reason for failure

function determine_num_inputs

int determine_num_inputs(
    vx_graph graph,
    vx_uint32 num_params
)

Determines the number of times the input tensor is passed to the graph.

Parameters:

  • graph - The graph to check
  • num_params - The total number of parameters

Return: The number of repeated input arguments

function to_float

std::vector< uint8_t > to_float(
    const std::vector< uint8_t > & in,
    int data_type,
    float scale
)

Convert the raw data in 'in' to a floating point representation.

Parameters:

  • in The raw binary buffer
  • data_type The data type the data represents
  • scale Any fixed point scale

Return: A raw binary buffer containing the values as floating point values

function find_output_tensors

graph_outputs find_output_tensors(
    std::vector< tensor_details > outputs,
    const int * out_scales,
    size_t scales_size
)

Removes tensor views from output and replaces with parent view.

Parameters:

  • outputs - The outputs as specified by netdeploy
  • out_scales - The scales to apply to the tensors
  • scales_size - Number of scales

Return: a graph_outputs struct with the output tensors and their scales

Attributes Documentation

variable VX_GSF_IMAGE_F32

constexpr auto VX_GSF_IMAGE_F32 = VX_DF_IMAGE('F', '0', '3', '2');

This is an image format extension.


Updated on 2023-11-29 at 18:22:17 +0000