tensorflow
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.
tensorflow supports the following C API and Octave specific functions. Extra input arguments are identified as in2, in3, in3, etc.
'TF_Version'
char vector containing tensorflow C API version.
'TF_NewBuffer'
uint64 pointer to new Buffer.
'TF_DeleteBuffer'
uint64 pointer to Buffer to be deleted.
'TF_NewBufferFromString'
uint8 or char to be saved into a new Buffer.
'TF_GetBuffer'
uint64 pointer to Buffer to get the data from.
uint8 from Buffer.
'TF_GetBufferToString'
uint64 pointer to Buffer to get the data from.
char from Buffer.
'TF_DataTypeName'
uint32 index to DataType.
char DataType name.
'TF_DataTypeSize'
uint32 index to DataType.
uint64 bytesize of selected DataType.
'TF_NewGraph'
uint64 pointer to new Graph.
'TF_DeleteGraph'
uint64 pointer to Graph.
'TF_GraphSetTensorShape'
uint64 pointer to Graph.
uint64 pointer to Output.
uint64 size of dimensions of Output in Graph.
int32 number of dimensions of Output in Graph.
uint64 pointer to Status.
'TF_GraphGetTensorNumDims'
int32 number of dimensions of Output in Graph.
uint64 pointer to Graph.
uint64 pointer to Output.
uint64 pointer to Status.
'TF_GraphGetTensorShape'
uint64 size of dimensions of Output in Graph.
uint64 pointer to Graph.
uint64 pointer to Output.
int32 number of dimensions of Output in Graph.
uint64 pointer to Status.
'TF_NewOperationLocked'
uint64 pointer to new OperationDescription.
uint64 pointer to Graph.
char type of new Operation.
char name of new Operation.
'TF_NewOperation'
uint64 pointer to new OperationDescription.
uint64 pointer to Graph.
char type of new Operation.
char name of new Operation.
'TF_GraphOperationByName'
uint64 pointer to Operation.
uint64 pointer to Graph.
char name of Operation in Graph.
'TF_GraphNextOperation'
uint64 pointer to Operation.
uint64 pointer to Graph.
uint64 position of Operation in Graph.
'TF_GraphToGraphDef'
uint64 pointer to Graph.
uint64 pointer to Buffer.
uint64 pointer to Status.
'TF_GraphGetOpDef'
uint64 pointer to Graph.
char name of OperationDefinition in Graph.
uint64 pointer to Buffer.
uint64 pointer to Status.
'TF_GraphVersions'
uint64 pointer to Graph.
uint64 pointer to Buffer.
uint64 pointer to Status.
'TF_GraphImportGraphDefWithResults'
uint64 pointer to ImportGraphDefResults.
uint64 pointer to Graph.
uint64 pointer to Buffer.
uint64 pointer to ImportGraphDefOptions.
uint64 pointer to Status.
'TF_GraphImportGraphDefWithReturnOutputs'
uint64 pointer to Graph.
uint64 pointer to Buffer.
uint64 pointer to ImportGraphDefOptions.
uint64 pointer to Output(s).
int32 number of return Output(s).
uint64 pointer to Status.
'TF_GraphImportGraphDef'
uint64 pointer to Graph.
uint64 pointer to Buffer.
uint64 pointer to ImportGraphDefOptions.
uint64 pointer to Status.
'TF_GraphCopyFunction'
uint64 pointer to Graph.
uint64 pointer to Function.
uint64 pointer to gradient Function.
uint64 pointer to Status.
'TF_GraphNumFunctions'
int32 number of Functions in Graph.
uint64 pointer to Graph.
'TF_GraphGetFunctions'
uint64 pointer(s) to Function(s) in Graph.
uint64 pointer to Graph.
uint64 pointer to Status.
'TF_NewWhile'
uint64 pointer to new WhileParams.
uint64 pointer to Graph.
uint64 pointer to Output.
int32 number of inputs.
uint64 pointer to Status.
'TF_AddGradients'
uint64 pointer to Graph.
uint64 pointer to Output y.
int32 number of inputs in y.
uint64 pointer to Output x.
int32 number of inputs in x.
uint64 pointer to Output dx.
uint64 pointer to Status.
uint64 pointer to Output dy.
'TF_AddGradientsWithPrefix'
uint64 pointer to Graph.
char prefix for Gradient.
uint64 pointer to Output y.
int32 number of inputs in y.
uint64 pointer to Output x.
int32 number of inputs in x.
uint64 pointer to Output dx.
uint64 pointer to Status.
uint64 pointer to Output dy.
'TF_Input'
uint64 pointer to Input.
'TF_DeleteInput'
uint64 pointer to Input.
'TF_OperationInputType'
uint32 index to DataType.
uint64 pointer to Input.
'TF_OperationInput'
uint64 pointer to Output.
uint64 pointer to Input.
'TF_OperationName'
char operation name.
uint64 pointer to Operation.
'TF_OperationOpType'
char operation type.
uint64 pointer to Operation.
'TF_OperationDevice'
char operation device.
uint64 pointer to Operation.
'TF_OperationNumOutputs'
int32 number of outputs in Operation.
uint64 pointer to Operation.
'TF_OperationOutputListLength'
int32 length of output list in Operation.
uint64 pointer to Operation.
char name of output list in Operation.
uint64 pointer to Status.
'TF_OperationNumInputs'
int32 number of inputs in Operation.
uint64 pointer to Operation.
'TF_OperationInputListLength'
int32 length of input list in Operation.
uint64 pointer to Operation.
char name of input list in Operation.
uint64 pointer to Status.
'TF_OperationAllInputs'
uint64 pointers to Output inputs in Operation.
uint64 pointer to Operation.
'OCT_TF_OperationNumControlInputs'
int32 number of control inputs to an Operation.
uint64 pointer to Operation.
'OCT_TF_OperationGetControlInputs'
uint64 pointers to control inputs to an Operation.
uint64 pointer to Operation.
'OCT_TF_OperationNumControlOutputs'
int32 number of operations that have Operation in2 as a control input.
uint64 pointer to Operation.
'OCT_TF_OperationGetControlOutputs'
uint64 pointers to operations that have Operation in2 as a control input.
uint64 pointer to Operation.
'TF_SetDevice'
uint64 pointer to OperationDescription.
char device name.
'TF_AddInput'
uint64 pointer to OperationDescription.
uint64 pointer to Output input.
'TF_AddInputList'
uint64 pointer to OperationDescription.
uint64 pointers to Output inputs.
'TF_AddControlInput'
uint64 pointer to OperationDescription.
uint64 pointer to Operation.
'TF_SetAttrString'
uint64 pointer to OperationDescription.
char name of attribute.
char value for attribute.
'TF_SetAttrStringList'
uint64 pointer to OperationDescription.
char name of attribute.
cellstr values for attribute.
'TF_SetAttrInt'
uint64 pointer to OperationDescription.
char name of attribute.
int64 value for attribute.
'TF_SetAttrIntList'
uint64 pointer to OperationDescription.
char name of attribute.
int64 values for attribute.
'TF_SetAttrFloat'
uint64 pointer to OperationDescription.
char name of attribute.
single value for attribute.
'TF_SetAttrFloatList'
uint64 pointer to OperationDescription.
char name of attribute.
single values for attribute.
'TF_SetAttrBool'
uint64 pointer to OperationDescription.
char name of attribute.
logical value for attribute.
'TF_SetAttrBoolList'
uint64 pointer to OperationDescription.
char name of attribute.
logical values for attribute.
'TF_SetAttrType'
uint64 pointer to OperationDescription.
char name of attribute.
uint32 DataType for attribute.
'TF_SetAttrTypeList'
uint64 pointer to OperationDescription.
char name of attribute.
uint32 DataTypes for attribute.
'TF_SetAttrPlaceholder'
uint64 pointer to OperationDescription.
char name of attribute.
char placeholder for attribute.
'TF_SetAttrFuncName'
uint64 pointer to OperationDescription.
char name of attribute.
char function name for attribute.
'TF_SetAttrShape'
uint64 pointer to OperationDescription.
char name of attribute.
int64 the size of the dimensions of the attribute’s shape.
int32 the number of the dimensions of the attribute’s shape.
'TF_SetAttrShapeList'
uint64 pointer to OperationDescription.
char name of attribute.
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.
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'
uint64 pointer to OperationDescription.
char name of attribute.
uint8 binary-serialized TensorShapeProto data.
uint64 pointer to Status.
'OCT_TF_SetAttrTensorShapeProtoList'
uint64 pointer to OperationDescription.
char name of attribute.
cell a list of binary-serialized TensorShapeProto data, each represented as a uint8 vector.
uint64 pointer to Status.
'TF_SetAttrTensor'
uint64 pointer to OperationDescription.
char name of attribute.
uint64 pointer to Tensor.
uint64 pointer to Status.
'TF_SetAttrTensorList'
uint64 pointer to OperationDescription.
char name of attribute.
uint64 pointers to Tensors.
uint64 pointer to Status.
'TF_SetAttrValueProto'
uint64 pointer to OperationDescription.
char name of attribute.
uint8 a binary serialization of an AttrValue protocol buffer for attribute.
uint64 pointer to Status.
'TF_FinishOperationLocked'
uint64 pointer to Operation.
uint64 pointer to OperationDescription.
uint64 pointer to Status.
'TF_FinishOperation'
uint64 pointer to Operation.
uint64 pointer to OperationDescription.
uint64 pointer to Status.
'TF_Output'
uint64 pointer to Output.
'TF_DeleteOutput'
uint64 pointer to Output.
'TF_OperationOutputType'
uint32 index to DataType.
uint64 pointer to Output.
'TF_OperationOutputNumConsumers'
int32 number of consumers of Output.
uint64 pointer to Output.
'TF_OperationOutputConsumers'
uint64 pointers to consumers of Output.
uint64 pointer to Output.
'TF_NewStatus'
uint64 pointer to new Status.
'TF_DeleteStatus'
uint64 pointer to Status.
'TF_SetStatus'
uint64 pointer to Status.
uint32 Code to Status.
char message to Status.
'TF_SetPayload'
uint64 pointer to Status.
char ’key’ as payload to Status.
char ’value’ as payload to Status.
'TF_SetStatus'
uint64 pointer to Status.
int32 I/O error code.
char message for I/O error code.
'TF_GetCode'
uint32 Code from Status.
'TF_Message'
char message from Status.
'TF_NewTString'
uint64 pointer to new TString.
'TF_LoadTString'
uint64 pointer to new TString.
char character vector to new TString.
'TF_SaveTString'
char character vector from TString.
uint64 pointer to new TString.
'TF_StringInit'
uint64 pointer to TString.
'TF_StringCopy'
uint64 pointer to destination TString.
char character vector as source string.
uint64 length of source string.
'TF_StringAssignView'
uint64 pointer to destination TString.
char character vector as source string.
uint64 length of source string.
'TF_StringGetDataPointer'
uint64 pointer to TString data.
uint64 pointer to TString.
'TF_StringGetType'
uint32 type of TString.
uint64 pointer to TString.
'TF_StringGetSize'
uint64 size of TString.
uint64 pointer to TString.
'TF_StringGetCapacity'
uint64 capacity of TString.
uint64 pointer to TString.
'TF_StringDealloc'
uint64 pointer to TString.
'TF_LoadTensor'
uint64 pointer to new Tensor.
'TF_SaveTensor'
uint64 pointer to Tensor.
'TF_NewTensor'
uint64 pointer to new Tensor.
uint32 DataType code for new Tensor.
int64 size of dimensions for new Tensor.
int32 number of dimensions for new Tensor.
uint64 pointer to data for new Tensor.
uint64 bytesize of data for new Tensor.
'TF_AllocateTensor'
uint64 pointer to new Tensor.
uint32 DataType code for new Tensor.
int64 size of dimensions for new Tensor.
int32 number of dimensions for new Tensor.
uint64 bytesize of data for new Tensor.
'TF_TensorMaybeMove'
uint64 pointer to maybe moved Tensor.
uint64 pointer to Tensor.
'TF_DeleteTensor'
uint64 pointer to Tensor.
'TF_TensorType'
uint32 DataType code of Tensor.
uint64 pointer to Tensor.
'TF_SetShape'
uint64 pointer to Tensor.
int64 size of dimensions for new Tensor.
int32 number of dimensions for new Tensor.
'TF_NumDims'
int32 number of dimensions of Tensor.
uint64 pointer to Tensor.
'TF_Dim'
int64 size of indexed dimension of Tensor.
uint64 pointer to Tensor.
int32 dimension index.
'TF_TensorByteSize'
uint64 bytesize of Tensor.
uint64 pointer to Tensor.
'TF_TensorData'
uint64 pointer to data from Tensor.
uint64 pointer to Tensor.
'TF_TensorFromProto'
uint64 pointer to Buffer.
uint64 pointer to Tensor.
uint64 pointer to Status.
'TF_TensorElementCount'
int64 number of elements in Tensor.
uint64 pointer to Tensor.
'TF_TensorBitcastFrom'
uint64 pointer to source Tensor.
uint32 DataType code for target Tensor.
uint64 pointer to target Tensor.
int64 size of dimensions for new Tensor.
int32 number of dimensions for new Tensor.
uint64 pointer to Status.
'TF_TensorIsAligned'
bool value for Tensor alignment.
uint64 pointer to Tensor.
Source Code: tensorflow