Categories &

Functions List

Function Reference: tensorflow

tensorflow: ref = tensorflow (TF_name, …)
tensorflow: out = tensorflow (TF_name, …)
tensorflow: tensorflow (TF_name, …)

This is a TensorFlow binding for GNU Octave.

ref = tensorflow (TF_name, …) takes a character vector, TF_name, defining the one of the available functions in the tensorflow C API (including any of the Octave specific functions) listed below, along with any other input arguments required by the specified function, and returns a memory pointer, ref, of the object created by the specified function. ref is always of uint64 type.

out = tensorflow (TF_name, …) may also return other types of octave_value according to the specification of the called C API function, as defined by TF_name. It should be noted that all memory pointers to objects passed as input arguments must also be of uint64 types.

tensorflow (TF_name, …) can also be called without any returning arguments depending on the specification of the called function, as defined by TF_name. In such cases, tensorflow is calling a C API function to delete an object, in which case its pointer should also be deleted from Octave workspace and never be reused (reusing this pointer will crash Octave), or the result of the operation can be retrieved through the pointers of the objects passed as uinput arguments.

Note that tensorflow uses the following conventions throughout its API.

  • uint64 is used for storing memory pointers or bytesize of data.
  • int64 is used for storing size of dimensions.
  • uint32 is used to store indexing to enumerations such as Tensor DataType or Status Code.
  • int32 is used for storing the number of dimensions.
  • uint8 is used for storing raw data retrieved from Buffers.
  • All vectors must be row vectors.

tensorflow supports the following C API and Octave specific functions. Extra input arguments are identified as in2, in3, in3, etc.

  • 'TF_Version'
    • out : char vector containing tensorflow C API version.

C API functions relared to the TF_Buffer classdef

  • 'TF_NewBuffer'
    • out : scalar uint64 pointer to new Buffer.
  • 'TF_DeleteBuffer'
    • in2 : scalar uint64 pointer to Buffer to be deleted.
  • 'TF_NewBufferFromString'
    • in2 : vector of uint8 or char to be saved into a new Buffer.
  • 'TF_GetBuffer'
    • in2 : scalar uint64 pointer to Buffer to get the data from.
    • out : vector of uint8 from Buffer.
  • 'TF_GetBufferToString'
    • in2 : scalar uint64 pointer to Buffer to get the data from.
    • out : vector of char from Buffer.

C API functions relared to the TF_DataType classdef

  • 'TF_DataTypeName'
    • in2 : scalar uint32 index to DataType.
    • out : vector of char DataType name.
  • 'TF_DataTypeSize'
    • in2 : scalar uint32 index to DataType.
    • out : scalar uint64 bytesize of selected DataType.

C API functions relared to the TF_Graph classdef

  • 'TF_NewGraph'
    • out : scalar uint64 pointer to new Graph.
  • 'TF_DeleteGraph'
    • in2 : scalar uint64 pointer to Graph.
  • 'TF_GraphSetTensorShape'
    • in2 : scalar uint64 pointer to Graph.
    • in3 : scalar uint64 pointer to Output.
    • in4 : vector uint64 size of dimensions of Output in Graph.
    • in5 : scalar int32 number of dimensions of Output in Graph.
    • in6 : scalar uint64 pointer to Status.
  • 'TF_GraphGetTensorNumDims'
    • out : scalar int32 number of dimensions of Output in Graph.
    • in2 : scalar uint64 pointer to Graph.
    • in3 : scalar uint64 pointer to Output.
    • in4 : scalar uint64 pointer to Status.
  • 'TF_GraphGetTensorShape'
    • out : vector uint64 size of dimensions of Output in Graph.
    • in2 : scalar uint64 pointer to Graph.
    • in3 : scalar uint64 pointer to Output.
    • in4 : scalar int32 number of dimensions of Output in Graph.
    • in5 : scalar uint64 pointer to Status.
  • 'TF_NewOperationLocked'
    • out : scalar uint64 pointer to new OperationDescription.
    • in2 : scalar uint64 pointer to Graph.
    • in3 : vector char type of new Operation.
    • in4 : vector char name of new Operation.
  • 'TF_NewOperation'
    • out : scalar uint64 pointer to new OperationDescription.
    • in2 : scalar uint64 pointer to Graph.
    • in3 : vector char type of new Operation.
    • in4 : vector char name of new Operation.
  • 'TF_GraphOperationByName'
    • out : scalar uint64 pointer to Operation.
    • in2 : scalar uint64 pointer to Graph.
    • in3 : vector char name of Operation in Graph.
  • 'TF_GraphNextOperation'
    • out : scalar uint64 pointer to Operation.
    • in2 : scalar uint64 pointer to Graph.
    • in3 : scalar uint64 position of Operation in Graph.
  • 'TF_GraphToGraphDef'
    • in2 : scalar uint64 pointer to Graph.
    • in3 : scalar uint64 pointer to Buffer.
    • in4 : scalar uint64 pointer to Status.
  • 'TF_GraphGetOpDef'
    • in2 : scalar uint64 pointer to Graph.
    • in3 : vector char name of OperationDefinition in Graph.
    • in4 : scalar uint64 pointer to Buffer.
    • in5 : scalar uint64 pointer to Status.
  • 'TF_GraphVersions'
    • in2 : scalar uint64 pointer to Graph.
    • in4 : scalar uint64 pointer to Buffer.
    • in5 : scalar uint64 pointer to Status.
  • 'TF_GraphImportGraphDefWithResults'
    • out : scalar uint64 pointer to ImportGraphDefResults.
    • in2 : scalar uint64 pointer to Graph.
    • in4 : scalar uint64 pointer to Buffer.
    • in4 : scalar uint64 pointer to ImportGraphDefOptions.
    • in5 : scalar uint64 pointer to Status.
  • 'TF_GraphImportGraphDefWithReturnOutputs'
    • in2 : scalar uint64 pointer to Graph.
    • in3 : scalar uint64 pointer to Buffer.
    • in4 : scalar uint64 pointer to ImportGraphDefOptions.
    • in5 : scalar uint64 pointer to Output(s).
    • in6 : scalar int32 number of return Output(s).
    • in7 : scalar uint64 pointer to Status.
  • 'TF_GraphImportGraphDef'
    • in2 : scalar uint64 pointer to Graph.
    • in3 : scalar uint64 pointer to Buffer.
    • in4 : scalar uint64 pointer to ImportGraphDefOptions.
    • in5 : scalar uint64 pointer to Status.
  • 'TF_GraphCopyFunction'
    • in2 : scalar uint64 pointer to Graph.
    • in3 : scalar uint64 pointer to Function.
    • in4 : scalar uint64 pointer to gradient Function.
    • in5 : scalar uint64 pointer to Status.
  • 'TF_GraphNumFunctions'
    • out : scalar int32 number of Functions in Graph.
    • in2 : scalar uint64 pointer to Graph.
  • 'TF_GraphGetFunctions'
    • out : vector uint64 pointer(s) to Function(s) in Graph.
    • in2 : scalar uint64 pointer to Graph.
    • in3 : scalar uint64 pointer to Status.
  • 'TF_NewWhile'
    • out : scalar uint64 pointer to new WhileParams.
    • in2 : scalar uint64 pointer to Graph.
    • in3 : scalar uint64 pointer to Output.
    • in4 : scalar int32 number of inputs.
    • in5 : scalar uint64 pointer to Status.
  • 'TF_AddGradients'
    • in2 : scalar uint64 pointer to Graph.
    • in3 : scalar uint64 pointer to Output y.
    • in4 : scalar int32 number of inputs in y.
    • in5 : scalar uint64 pointer to Output x.
    • in6 : scalar int32 number of inputs in x.
    • in7 : scalar uint64 pointer to Output dx.
    • in8 : scalar uint64 pointer to Status.
    • in9 : scalar uint64 pointer to Output dy.
  • 'TF_AddGradientsWithPrefix'
    • in2 : scalar uint64 pointer to Graph.
    • in3 : vector char prefix for Gradient.
    • in4 : scalar uint64 pointer to Output y.
    • in5 : scalar int32 number of inputs in y.
    • in6 : scalar uint64 pointer to Output x.
    • in7 : scalar int32 number of inputs in x.
    • in8 : scalar uint64 pointer to Output dx.
    • in9 : scalar uint64 pointer to Status.
    • in10 : scalar uint64 pointer to Output dy.

C API functions relared to the TF_Input classdef

  • 'TF_Input'
    • out : scalar uint64 pointer to Input.
  • 'TF_DeleteInput'
    • in2 : scalar uint64 pointer to Input.
  • 'TF_OperationInputType'
    • out : scalar uint32 index to DataType.
    • in2 : scalar uint64 pointer to Input.
  • 'TF_OperationInput'
    • out : scalar uint64 pointer to Output.
    • in2 : scalar uint64 pointer to Input.

C API functions relared to the TF_Operation classdef

  • 'TF_OperationName'
    • out : vector char operation name.
    • in2 : scalar uint64 pointer to Operation.
  • 'TF_OperationOpType'
    • out : vector char operation type.
    • in2 : scalar uint64 pointer to Operation.
  • 'TF_OperationDevice'
    • out : vector char operation device.
    • in2 : scalar uint64 pointer to Operation.
  • 'TF_OperationNumOutputs'
    • out : scalar int32 number of outputs in Operation.
    • in2 : scalar uint64 pointer to Operation.
  • 'TF_OperationOutputListLength'
    • out : scalar int32 length of output list in Operation.
    • in2 : scalar uint64 pointer to Operation.
    • in2 : vector char name of output list in Operation.
    • in2 : scalar uint64 pointer to Status.
  • 'TF_OperationNumInputs'
    • out : scalar int32 number of inputs in Operation.
    • in2 : scalar uint64 pointer to Operation.
  • 'TF_OperationInputListLength'
    • out : scalar int32 length of input list in Operation.
    • in2 : scalar uint64 pointer to Operation.
    • in2 : vector char name of input list in Operation.
    • in2 : scalar uint64 pointer to Status.
  • 'TF_OperationAllInputs'
    • out : vector uint64 pointers to Output inputs in Operation.
    • in2 : scalar uint64 pointer to Operation.
  • 'OCT_TF_OperationNumControlInputs'
    • out : scalar int32 number of control inputs to an Operation.
    • in2 : scalar uint64 pointer to Operation.
  • 'OCT_TF_OperationGetControlInputs'
    • out : vector uint64 pointers to control inputs to an Operation.
    • in2 : scalar uint64 pointer to Operation.
  • 'OCT_TF_OperationNumControlOutputs'
    • out : scalar int32 number of operations that have Operation in2 as a control input.
    • in2 : scalar uint64 pointer to Operation.
  • 'OCT_TF_OperationGetControlOutputs'
    • out : vector uint64 pointers to operations that have Operation in2 as a control input.
    • in2 : scalar uint64 pointer to Operation.

C API functions relared to the TF_OperationDescription classdef

  • 'TF_SetDevice'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char device name.
  • 'TF_AddInput'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : scalar uint64 pointer to Output input.
  • 'TF_AddInputList'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector uint64 pointers to Output inputs.
  • 'TF_AddControlInput'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : scalar uint64 pointer to Operation.
  • 'TF_SetAttrString'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : vector char value for attribute.
  • 'TF_SetAttrStringList'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : vector cellstr values for attribute.
  • 'TF_SetAttrInt'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : scalar int64 value for attribute.
  • 'TF_SetAttrIntList'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : vector int64 values for attribute.
  • 'TF_SetAttrFloat'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : scalar single value for attribute.
  • 'TF_SetAttrFloatList'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : vector single values for attribute.
  • 'TF_SetAttrBool'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : scalar logical value for attribute.
  • 'TF_SetAttrBoolList'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : vector logical values for attribute.
  • 'TF_SetAttrType'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : scalar uint32 DataType for attribute.
  • 'TF_SetAttrTypeList'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : vector uint32 DataTypes for attribute.
  • 'TF_SetAttrPlaceholder'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : vector char placeholder for attribute.
  • 'TF_SetAttrFuncName'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : vector char function name for attribute.
  • 'TF_SetAttrShape'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : vector int64 the size of the dimensions of the attribute’s shape.
    • in5 : scalar int32 the number of the dimensions of the attribute’s shape.
  • 'TF_SetAttrShapeList'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : matrix int64 the size of the dimensions of the attribute’s shapes with each row corresponding to a shape. The rows representing shapes with fewer dimensions are padded with zeros.
    • in5 : vector int32 the number of the dimensions of the attribute’s shapes with each element corresponding to a shape. The number of elements must equal the number of rows of the previous input.
  • 'TF_SetAttrTensorShapeProto'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : vector uint8 binary-serialized TensorShapeProto data.
    • in5 : scalar uint64 pointer to Status.
  • 'OCT_TF_SetAttrTensorShapeProtoList'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : vector cell a list of binary-serialized TensorShapeProto data, each represented as a uint8 vector.
    • in5 : scalar uint64 pointer to Status.
  • 'TF_SetAttrTensor'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : scalar uint64 pointer to Tensor.
    • in5 : scalar uint64 pointer to Status.
  • 'TF_SetAttrTensorList'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : vector uint64 pointers to Tensors.
    • in5 : scalar uint64 pointer to Status.
  • 'TF_SetAttrValueProto'
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : vector char name of attribute.
    • in4 : vector uint8 a binary serialization of an AttrValue protocol buffer for attribute.
    • in5 : scalar uint64 pointer to Status.
  • 'TF_FinishOperationLocked'
    • out : scalar uint64 pointer to Operation.
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : scalar uint64 pointer to Status.
  • 'TF_FinishOperation'
    • out : scalar uint64 pointer to Operation.
    • in2 : scalar uint64 pointer to OperationDescription.
    • in3 : scalar uint64 pointer to Status.

C API functions relared to the TF_Output classdef

  • 'TF_Output'
    • out : scalar uint64 pointer to Output.
  • 'TF_DeleteOutput'
    • in2 : scalar uint64 pointer to Output.
  • 'TF_OperationOutputType'
    • out : scalar uint32 index to DataType.
    • in2 : scalar uint64 pointer to Output.
  • 'TF_OperationOutputNumConsumers'
    • out : scalar int32 number of consumers of Output.
    • in2 : scalar uint64 pointer to Output.
  • 'TF_OperationOutputConsumers'
    • out : vector uint64 pointers to consumers of Output.
    • in2 : scalar uint64 pointer to Output.

C API functions relared to the TF_Status classdef

  • 'TF_NewStatus'
    • out : scalar uint64 pointer to new Status.
  • 'TF_DeleteStatus'
    • in2 : scalar uint64 pointer to Status.
  • 'TF_SetStatus'
    • in2 : scalar uint64 pointer to Status.
    • in3 : scalar uint32 Code to Status.
    • in4 : vector char message to Status.
  • 'TF_SetPayload'
    • in2 : scalar uint64 pointer to Status.
    • in3 : vector char ’key’ as payload to Status.
    • in4 : vector char ’value’ as payload to Status.
  • 'TF_SetStatus'
    • in2 : scalar uint64 pointer to Status.
    • in3 : scalar int32 I/O error code.
    • in4 : vector char message for I/O error code.
  • 'TF_GetCode'
    • out : scalar uint32 Code from Status.
  • 'TF_Message'
    • out : vector char message from Status.

C API functions relared to the TF_TString classdef

  • 'TF_NewTString'
    • out : scalar uint64 pointer to new TString.
  • 'TF_LoadTString'
    • out : scalar uint64 pointer to new TString.
    • in2: vector char character vector to new TString.
  • 'TF_SaveTString'
    • out : vector char character vector from TString.
    • in2 : scalar uint64 pointer to new TString.
  • 'TF_StringInit'
    • in2 : scalar uint64 pointer to TString.
  • 'TF_StringCopy'
    • in2 : scalar uint64 pointer to destination TString.
    • in3 : vector char character vector as source string.
    • in4 : scalar uint64 length of source string.
  • 'TF_StringAssignView'
    • in2 : scalar uint64 pointer to destination TString.
    • in3 : vector char character vector as source string.
    • in4 : scalar uint64 length of source string.
  • 'TF_StringGetDataPointer'
    • out : scalar uint64 pointer to TString data.
    • in2 : scalar uint64 pointer to TString.
  • 'TF_StringGetType'
    • out : scalar uint32 type of TString.
    • in2 : scalar uint64 pointer to TString.
  • 'TF_StringGetSize'
    • out : scalar uint64 size of TString.
    • in2 : scalar uint64 pointer to TString.
  • 'TF_StringGetCapacity'
    • out : scalar uint64 capacity of TString.
    • in2 : scalar uint64 pointer to TString.
  • 'TF_StringDealloc'
    • in2 : scalar uint64 pointer to TString.

C API functions relared to the TF_Tensor classdef

  • 'TF_LoadTensor'
    • out : scalar uint64 pointer to new Tensor.
    • in2 : any non-empty value of supported DataType.
  • 'TF_SaveTensor'
    • out : any value of supported DataType.
    • in2 : scalar uint64 pointer to Tensor.
  • 'TF_NewTensor'
    • out : scalar uint64 pointer to new Tensor.
    • in2 : scalar uint32 DataType code for new Tensor.
    • in3 : scalar int64 size of dimensions for new Tensor.
    • in4 : scalar int32 number of dimensions for new Tensor.
    • in5 : scalar uint64 pointer to data for new Tensor.
    • in5 : scalar uint64 bytesize of data for new Tensor.
  • 'TF_AllocateTensor'
    • out : scalar uint64 pointer to new Tensor.
    • in2 : scalar uint32 DataType code for new Tensor.
    • in3 : scalar int64 size of dimensions for new Tensor.
    • in4 : scalar int32 number of dimensions for new Tensor.
    • in5 : scalar uint64 bytesize of data for new Tensor.
  • 'TF_TensorMaybeMove'
    • out : scalar uint64 pointer to maybe moved Tensor.
    • in2 : scalar uint64 pointer to Tensor.
  • 'TF_DeleteTensor'
    • in2 : scalar uint64 pointer to Tensor.
  • 'TF_TensorType'
    • out : scalar uint32 DataType code of Tensor.
    • in2 : scalar uint64 pointer to Tensor.
  • 'TF_SetShape'
    • in2 : scalar uint64 pointer to Tensor.
    • in3 : scalar int64 size of dimensions for new Tensor.
    • in4 : scalar int32 number of dimensions for new Tensor.
  • 'TF_NumDims'
    • out : scalar int32 number of dimensions of Tensor.
    • in2 : scalar uint64 pointer to Tensor.
  • 'TF_Dim'
    • out : vector int64 size of indexed dimension of Tensor.
    • in2 : scalar uint64 pointer to Tensor.
    • in3 : scalar int32 dimension index.
  • 'TF_TensorByteSize'
    • out : vector uint64 bytesize of Tensor.
    • in2 : scalar uint64 pointer to Tensor.
  • 'TF_TensorData'
    • out : scalar uint64 pointer to data from Tensor.
    • in2 : scalar uint64 pointer to Tensor.
  • 'TF_TensorFromProto'
    • in2 : scalar uint64 pointer to Buffer.
    • in2 : scalar uint64 pointer to Tensor.
    • in2 : scalar uint64 pointer to Status.
  • 'TF_TensorElementCount'
    • out : scalar int64 number of elements in Tensor.
    • in2 : scalar uint64 pointer to Tensor.
  • 'TF_TensorBitcastFrom'
    • in2 : scalar uint64 pointer to source Tensor.
    • in3 : scalar uint32 DataType code for target Tensor.
    • in4 : scalar uint64 pointer to target Tensor.
    • in5 : scalar int64 size of dimensions for new Tensor.
    • in6 : scalar int32 number of dimensions for new Tensor.
    • in7 : scalar uint64 pointer to Status.
  • 'TF_TensorIsAligned'
    • out : scalar bool value for Tensor alignment.
    • in2 : scalar uint64 pointer to Tensor.

Source Code: tensorflow