View Source tflite_beam_tensor (tflite_beam v0.3.8)

A typed multi-dimensional array used in Tensorflow Lite.

Summary

Functions

Get the dimensions (C++) API

Get the quantization params

Get the tensor shape

Get the data type

Types

tflite_beam_tensor_type/0

-type tflite_beam_tensor_type() ::
          no_type |
          {f, 32} |
          {s, 32} |
          {u, 8} |
          {s, 64} |
          string | bool |
          {s, 16} |
          {c, 64} |
          {s, 8} |
          {f, 16} |
          {f, 64} |
          {c, 128} |
          {u, 64} |
          resource | variant |
          {u, 32}.

Functions

dims(Tflite_beam_tensor)

-spec dims(#tflite_beam_tensor{name :: binary(),
                               index :: non_neg_integer(),
                               shape :: tuple(),
                               shape_signature :: list(),
                               type :: tflite_beam_tensor_type(),
                               quantization_params ::
                                   #tflite_beam_quantization_params{scale :: term(),
                                                                    zero_point :: term(),
                                                                    quantized_dimension :: term()},
                               sparsity_params :: term(),
                               ref :: reference()} |
           reference()) ->
              [integer()] | {error, binary()}.

Get the dimensions (C++) API

quantization_params(Tflite_beam_tensor)

-spec quantization_params(#tflite_beam_tensor{name :: binary(),
                                              index :: non_neg_integer(),
                                              shape :: tuple(),
                                              shape_signature :: list(),
                                              type :: tflite_beam_tensor_type(),
                                              quantization_params ::
                                                  #tflite_beam_quantization_params{scale :: term(),
                                                                                   zero_point :: term(),
                                                                                   quantized_dimension ::
                                                                                       term()},
                                              sparsity_params :: term(),
                                              ref :: reference()} |
                          reference()) ->
                             #tflite_beam_quantization_params{scale :: term(),
                                                              zero_point :: term(),
                                                              quantized_dimension :: term()} |
                             {error, binary()}.

Get the quantization params

set_data(Tflite_beam_tensor, Data)

-spec set_data(#tflite_beam_tensor{name :: binary(),
                                   index :: non_neg_integer(),
                                   shape :: tuple(),
                                   shape_signature :: list(),
                                   type :: tflite_beam_tensor_type(),
                                   quantization_params ::
                                       #tflite_beam_quantization_params{scale :: term(),
                                                                        zero_point :: term(),
                                                                        quantized_dimension :: term()},
                                   sparsity_params :: term(),
                                   ref :: reference()} |
               reference(),
               binary()) ->
                  ok | {error, binary()}.

Set tensor data

shape(Tflite_beam_tensor)

-spec shape(#tflite_beam_tensor{name :: binary(),
                                index :: non_neg_integer(),
                                shape :: tuple(),
                                shape_signature :: list(),
                                type :: tflite_beam_tensor_type(),
                                quantization_params ::
                                    #tflite_beam_quantization_params{scale :: term(),
                                                                     zero_point :: term(),
                                                                     quantized_dimension :: term()},
                                sparsity_params :: term(),
                                ref :: reference()} |
            reference()) ->
               tuple() | {error, binary()}.

Get the tensor shape

to_binary(Tflite_beam_tensor)

-spec to_binary(#tflite_beam_tensor{name :: binary(),
                                    index :: non_neg_integer(),
                                    shape :: tuple(),
                                    shape_signature :: list(),
                                    type :: tflite_beam_tensor_type(),
                                    quantization_params ::
                                        #tflite_beam_quantization_params{scale :: term(),
                                                                         zero_point :: term(),
                                                                         quantized_dimension :: term()},
                                    sparsity_params :: term(),
                                    ref :: reference()} |
                reference()) ->
                   binary() | {error, binary()}.

Get binary data

to_binary(Tflite_beam_tensor, MaxBytes)

-spec to_binary(#tflite_beam_tensor{name :: binary(),
                                    index :: non_neg_integer(),
                                    shape :: tuple(),
                                    shape_signature :: list(),
                                    type :: tflite_beam_tensor_type(),
                                    quantization_params ::
                                        #tflite_beam_quantization_params{scale :: term(),
                                                                         zero_point :: term(),
                                                                         quantized_dimension :: term()},
                                    sparsity_params :: term(),
                                    ref :: reference()} |
                reference(),
                non_neg_integer()) ->
                   binary() | {error, binary()}.

Get binary data

type(Tflite_beam_tensor)

-spec type(#tflite_beam_tensor{name :: binary(),
                               index :: non_neg_integer(),
                               shape :: tuple(),
                               shape_signature :: list(),
                               type :: tflite_beam_tensor_type(),
                               quantization_params ::
                                   #tflite_beam_quantization_params{scale :: term(),
                                                                    zero_point :: term(),
                                                                    quantized_dimension :: term()},
                               sparsity_params :: term(),
                               ref :: reference()} |
           reference()) ->
              tflite_beam_tensor_type() | {error, binary()}.

Get the data type