import numpy
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tflite'))
-sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../externals/flatbuffers/python'))
+sys.path.append(
+ os.path.join(
+ os.path.dirname(os.path.abspath(__file__)), '../../externals/flatbuffers/python'))
import flatbuffers
import tflite.Model
BuiltinOpcodeStrList = {}
+
def SetBuiltinOpcodeStr():
BuiltinOpcodeStrList[0] = "ADD"
BuiltinOpcodeStrList[1] = "AVERAGE_POOL_2D"
BuiltinOpcodeStrList[52] = "BIDIRECTIONAL_SEQUENCE_LSTM"
BuiltinOpcodeStrList[53] = "CAST"
+
def PrintOperatorInfo(tf_model, tf_subgraph):
print("Operators list\n")
print('')
+
def GetShapeStringFromTensor(tf_tensor):
if tf_tensor.ShapeLength() == 0:
return "Scalar"
return return_string
+
def PrintTensorInfo(tf_model, tf_subgraph):
print("Tensor-Buffer mapping & shape\n")
if tf_tensor.Name() != 0:
shape_name = tf_tensor.Name()
- print_str = "Tensor {0:4} : buffer {1:4} | {2} | Shape {3} | {4}".format(tensor_idx, buffer_idx, isEmpty, shape_str, shape_name)
+ print_str = "Tensor {0:4} : buffer {1:4} | {2} | Shape {3} | {4}".format(
+ tensor_idx, buffer_idx, isEmpty, shape_str, shape_name)
print(print_str)
print('')
+
def main(args):
# Read flatbuffer file descriptor using argument
tflite_file = args.input_file
# tensor and length of tensor
PrintTensorInfo(tf_model, tf_subgraph)
+
if __name__ == '__main__':
# Define argument and read
arg_parser = argparse.ArgumentParser()
- arg_parser.add_argument("input_file", type=argparse.FileType('rb'), help="tflite file to read")
+ arg_parser.add_argument(
+ "input_file", type=argparse.FileType('rb'), help="tflite file to read")
args = arg_parser.parse_args()
# Call main function
import numpy
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tflite'))
-sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../externals/flatbuffers/python'))
+sys.path.append(
+ os.path.join(
+ os.path.dirname(os.path.abspath(__file__)), '../../externals/flatbuffers/python'))
import flatbuffers
import tflite.Model
import tflite.BuiltinOptions
import argparse
+
# Assume we use only main model in model file
# Get selected operators from file, and return operator index list
def GetOperatorList(oplist_file):
opcode_list.append(int(word))
else:
print("Error: Cannot get operator list")
- print("Please pass operators as operator index list split by space and/or line")
+ print(
+ "Please pass operators as operator index list split by space and/or line"
+ )
exit(1)
if len(opcode_list) == 0:
return opcode_list
+
def GenerateOperatorCodes(new_builder, sample_model):
operator_code_num = sample_model.OperatorCodesLength()
new_operator_code_list = []
for operator_code_idx in range(operator_code_num):
operator_code = sample_model.OperatorCodes(operator_code_idx)
operator_code_string = operator_code.CustomCode()
- if (operator_code_string != "") and (not operator_code_string in new_operator_code_string_list):
- new_operator_code_string_list[operator_code_string] = new_builder.CreateString(operator_code_string)
+ if (operator_code_string !=
+ "") and (not operator_code_string in new_operator_code_string_list):
+ new_operator_code_string_list[
+ operator_code_string] = new_builder.CreateString(operator_code_string)
# Create tables of operator_code
for operator_code_idx in range(operator_code_num):
# Create operator_code table
tflite.OperatorCode.OperatorCodeStart(new_builder)
- tflite.OperatorCode.OperatorCodeAddBuiltinCode(new_builder, operator_code.BuiltinCode())
+ tflite.OperatorCode.OperatorCodeAddBuiltinCode(new_builder,
+ operator_code.BuiltinCode())
new_operator_code_string = operator_code.CustomCode()
if new_operator_code_string in new_operator_code_string_list:
- tflite.OperatorCode.OperatorCodeAddCustomCode(new_builder, new_operator_code_string_list[new_operator_code_string])
+ tflite.OperatorCode.OperatorCodeAddCustomCode(
+ new_builder, new_operator_code_string_list[new_operator_code_string])
new_operator_code = tflite.OperatorCode.OperatorCodeEnd(new_builder)
new_operator_code_list.append(new_operator_code)
return new_builder.EndVector(operator_code_num)
+
def GenerateQuantization(new_builder, selected_quantization):
# Create min vector
min_num = selected_quantization.MinLength()
if min_num != 0:
- tflite.QuantizationParameters.QuantizationParametersStartMinVector(new_builder, min_num)
+ tflite.QuantizationParameters.QuantizationParametersStartMinVector(
+ new_builder, min_num)
for min_idx in reversed(range(min_num)):
new_builder.PrependFloat32(selected_quantization.Min(min_idx))
new_min = new_builder.EndVector(min_num)
# Create max vector
max_num = selected_quantization.MaxLength()
if max_num != 0:
- tflite.QuantizationParameters.QuantizationParametersStartMaxVector(new_builder, max_num)
+ tflite.QuantizationParameters.QuantizationParametersStartMaxVector(
+ new_builder, max_num)
for max_idx in reversed(range(max_num)):
new_builder.PrependFloat32(selected_quantization.Max(max_idx))
new_max = new_builder.EndVector(max_num)
# Create scale vector
scale_num = selected_quantization.ScaleLength()
if scale_num != 0:
- tflite.QuantizationParameters.QuantizationParametersStartScaleVector(new_builder, scale_num)
+ tflite.QuantizationParameters.QuantizationParametersStartScaleVector(
+ new_builder, scale_num)
for scale_idx in reversed(range(scale_num)):
new_builder.PrependFloat32(selected_quantization.Scale(scale_idx))
new_scale = new_builder.EndVector(scale_num)
# Create zero_point vector
zeropoint_num = selected_quantization.ZeroPointLength()
if zeropoint_num != 0:
- tflite.QuantizationParameters.QuantizationParametersStartScaleVector(new_builder, zeropoint_num)
+ tflite.QuantizationParameters.QuantizationParametersStartScaleVector(
+ new_builder, zeropoint_num)
for zeropoint_idx in reversed(range(zeropoint_num)):
new_builder.PrependFloat32(selected_quantization.ZeroPoint(zeropoint_idx))
new_zeropoint = new_builder.EndVector(zeropoint_num)
if max_num != 0:
tflite.QuantizationParameters.QuantizationParametersAddMax(new_builder, new_max)
if scale_num != 0:
- tflite.QuantizationParameters.QuantizationParametersAddScale(new_builder, new_scale)
+ tflite.QuantizationParameters.QuantizationParametersAddScale(
+ new_builder, new_scale)
if zeropoint_num != 0:
- tflite.QuantizationParameters.QuantizationParametersAddZeroPoint(new_builder, new_zeropoint)
+ tflite.QuantizationParameters.QuantizationParametersAddZeroPoint(
+ new_builder, new_zeropoint)
return tflite.QuantizationParameters.QuantizationParametersEnd(new_builder)
+
def GenerateTensor(new_builder, selected_tensor, used_buffers_dic):
# Create shape vector for tensor
return tflite.Tensor.TensorEnd(new_builder)
+
def GenerateTensors(new_builder, selected_subgraph, used_tensors_dic, used_buffers_dic):
tensor_num = selected_subgraph.TensorsLength()
new_tensor_list = []
return new_builder.EndVector(new_tensor_num)
+
import tflite.Conv2DOptions
import tflite.DepthwiseConv2DOptions
import tflite.Pool2DOptions
import tflite.ConcatenationOptions
import tflite.ReshapeOptions
+
def GenerateBuiltinOption(new_builder, selected_builtin_option, builtin_option_type):
if builtin_option_type == tflite.BuiltinOptions.BuiltinOptions().Conv2DOptions:
conv2d_options.Init(selected_builtin_option.Bytes, selected_builtin_option.Pos)
tflite.Conv2DOptions.Conv2DOptionsStart(new_builder)
- tflite.Conv2DOptions.Conv2DOptionsAddPadding(new_builder, conv2d_options.Padding())
- tflite.Conv2DOptions.Conv2DOptionsAddStrideW(new_builder, conv2d_options.StrideW())
- tflite.Conv2DOptions.Conv2DOptionsAddStrideH(new_builder, conv2d_options.StrideH())
- tflite.Conv2DOptions.Conv2DOptionsAddFusedActivationFunction(new_builder, conv2d_options.FusedActivationFunction())
+ tflite.Conv2DOptions.Conv2DOptionsAddPadding(new_builder,
+ conv2d_options.Padding())
+ tflite.Conv2DOptions.Conv2DOptionsAddStrideW(new_builder,
+ conv2d_options.StrideW())
+ tflite.Conv2DOptions.Conv2DOptionsAddStrideH(new_builder,
+ conv2d_options.StrideH())
+ tflite.Conv2DOptions.Conv2DOptionsAddFusedActivationFunction(
+ new_builder, conv2d_options.FusedActivationFunction())
return tflite.Conv2DOptions.Conv2DOptionsEnd(new_builder)
- if builtin_option_type == tflite.BuiltinOptions.BuiltinOptions().DepthwiseConv2DOptions:
+ if builtin_option_type == tflite.BuiltinOptions.BuiltinOptions(
+ ).DepthwiseConv2DOptions:
depthconv2d_option = tflite.DepthwiseConv2DOptions.DepthwiseConv2DOptions()
- depthconv2d_option.Init(selected_builtin_option.Bytes, selected_builtin_option.Pos)
+ depthconv2d_option.Init(selected_builtin_option.Bytes,
+ selected_builtin_option.Pos)
tflite.DepthwiseConv2DOptions.DepthwiseConv2DOptionsStart(new_builder)
- tflite.DepthwiseConv2DOptions.DepthwiseConv2DOptionsAddPadding(new_builder, depthconv2d_option.Padding())
- tflite.DepthwiseConv2DOptions.DepthwiseConv2DOptionsAddStrideW(new_builder, depthconv2d_option.StrideW())
- tflite.DepthwiseConv2DOptions.DepthwiseConv2DOptionsAddStrideH(new_builder, depthconv2d_option.StrideH())
- tflite.DepthwiseConv2DOptions.DepthwiseConv2DOptionsAddDepthMultiplier(new_builder, depthconv2d_option.DepthMultiplier())
- tflite.DepthwiseConv2DOptions.DepthwiseConv2DOptionsAddFusedActivationFunction(new_builder, depthconv2d_option.FusedActivationFunction())
+ tflite.DepthwiseConv2DOptions.DepthwiseConv2DOptionsAddPadding(
+ new_builder, depthconv2d_option.Padding())
+ tflite.DepthwiseConv2DOptions.DepthwiseConv2DOptionsAddStrideW(
+ new_builder, depthconv2d_option.StrideW())
+ tflite.DepthwiseConv2DOptions.DepthwiseConv2DOptionsAddStrideH(
+ new_builder, depthconv2d_option.StrideH())
+ tflite.DepthwiseConv2DOptions.DepthwiseConv2DOptionsAddDepthMultiplier(
+ new_builder, depthconv2d_option.DepthMultiplier())
+ tflite.DepthwiseConv2DOptions.DepthwiseConv2DOptionsAddFusedActivationFunction(
+ new_builder, depthconv2d_option.FusedActivationFunction())
return tflite.DepthwiseConv2DOptions.DepthwiseConv2DOptionsEnd(new_builder)
if builtin_option_type == tflite.BuiltinOptions.BuiltinOptions().Pool2DOptions:
tflite.Pool2DOptions.Pool2DOptionsAddPadding(new_builder, pool2d_option.Padding())
tflite.Pool2DOptions.Pool2DOptionsAddStrideW(new_builder, pool2d_option.StrideW())
tflite.Pool2DOptions.Pool2DOptionsAddStrideH(new_builder, pool2d_option.StrideH())
- tflite.Pool2DOptions.Pool2DOptionsAddFilterWidth(new_builder, pool2d_option.FilterWidth())
- tflite.Pool2DOptions.Pool2DOptionsAddFilterHeight(new_builder, pool2d_option.FilterHeight())
- tflite.Pool2DOptions.Pool2DOptionsAddFusedActivationFunction(new_builder, pool2d_option.FusedActivationFunction())
+ tflite.Pool2DOptions.Pool2DOptionsAddFilterWidth(new_builder,
+ pool2d_option.FilterWidth())
+ tflite.Pool2DOptions.Pool2DOptionsAddFilterHeight(new_builder,
+ pool2d_option.FilterHeight())
+ tflite.Pool2DOptions.Pool2DOptionsAddFusedActivationFunction(
+ new_builder, pool2d_option.FusedActivationFunction())
return tflite.Pool2DOptions.Pool2DOptionsEnd(new_builder)
- if builtin_option_type == tflite.BuiltinOptions.BuiltinOptions().FullyConnectedOptions:
+ if builtin_option_type == tflite.BuiltinOptions.BuiltinOptions(
+ ).FullyConnectedOptions:
fc_option = tflite.FullyConnectedOptions.FullyConnectedOptions()
fc_option.Init(selected_builtin_option.Bytes, selected_builtin_option.Pos)
tflite.FullyConnectedOptions.FullyConnectedOptionsStart(new_builder)
- tflite.FullyConnectedOptions.FullyConnectedOptionsAddFusedActivationFunction(new_builder, fc_option.FusedActivationFunction())
+ tflite.FullyConnectedOptions.FullyConnectedOptionsAddFusedActivationFunction(
+ new_builder, fc_option.FusedActivationFunction())
return tflite.FullyConnectedOptions.FullyConnectedOptionsEnd(new_builder)
if builtin_option_type == tflite.BuiltinOptions.BuiltinOptions().SoftmaxOptions:
concat_option.Init(selected_builtin_option.Bytes, selected_builtin_option.Pos)
tflite.ConcatenationOptions.ConcatenationOptionsStart(new_builder)
- tflite.ConcatenationOptions.ConcatenationOptionsAddAxis(new_builder, concat_option.Axis())
- tflite.ConcatenationOptions.ConcatenationOptionsAddFusedActivationFunction(new_builder, concat_option.FusedActivationFunction())
+ tflite.ConcatenationOptions.ConcatenationOptionsAddAxis(
+ new_builder, concat_option.Axis())
+ tflite.ConcatenationOptions.ConcatenationOptionsAddFusedActivationFunction(
+ new_builder, concat_option.FusedActivationFunction())
return tflite.ConcatenationOptions.ConcatenationOptionsEnd(new_builder)
if builtin_option_type == tflite.BuiltinOptions.BuiltinOptions().ReshapeOptions:
shape_num = reshape_option.NewShapeLength()
if shape_num != 0:
- tflite.ReshapeOptions.ReshapeOptionsStartNewShapeVector(new_builder, shape_num)
+ tflite.ReshapeOptions.ReshapeOptionsStartNewShapeVector(
+ new_builder, shape_num)
for new_shape_idx in reversed(range(shape_num)):
new_shape_val = reshape_option.NewShape(new_shape_idx)
new_builder.PrependInt32(new_shape_val)
# Cannot handle builtin option type yet
return 0
+
def GenerateOperator(new_builder, selected_operator, used_tensors_dic):
# define opcode_index
builtin_option_type = selected_operator.BuiltinOptionsType()
if builtin_option_type != 0:
selected_builtin_option = selected_operator.BuiltinOptions()
- new_builtin_option = GenerateBuiltinOption(new_builder, selected_builtin_option, builtin_option_type)
+ new_builtin_option = GenerateBuiltinOption(new_builder, selected_builtin_option,
+ builtin_option_type)
# Create custum option vector
custom_option_num = selected_operator.CustomOptionsLength()
if builtin_option_type != 0:
tflite.Operator.OperatorAddBuiltinOptions(new_builder, new_builtin_option)
if custom_option_num != 0:
- tflite.Operator.OperatorAddCustomOptions(new_builder,new_custom_option)
+ tflite.Operator.OperatorAddCustomOptions(new_builder, new_custom_option)
tflite.Operator.OperatorAddCustomOptionsFormat(new_builder, custom_option_type)
return tflite.Operator.OperatorEnd(new_builder)
+
def GenerateOperators(new_builder, selected_subgraph, opcode_list, used_tensors_dic):
operator_num = selected_subgraph.OperatorsLength()
new_operator_list = []
for operator_idx in range(operator_num):
if operator_idx in opcode_list:
selected_operator = selected_subgraph.Operators(operator_idx)
- new_operator = GenerateOperator(new_builder, selected_operator, used_tensors_dic)
+ new_operator = GenerateOperator(new_builder, selected_operator,
+ used_tensors_dic)
new_operator_list.append(new_operator)
new_operator_num = len(new_operator_list)
return new_builder.EndVector(new_operator_num)
-def GenerateSubgraph(new_builder, selected_subgraph, opcode_list, new_input_tensor, new_output_tensor, used_tensors_dic, used_buffers_dic):
+
+def GenerateSubgraph(new_builder, selected_subgraph, opcode_list, new_input_tensor,
+ new_output_tensor, used_tensors_dic, used_buffers_dic):
# Tensors
- tensors = GenerateTensors(new_builder, selected_subgraph, used_tensors_dic, used_buffers_dic)
+ tensors = GenerateTensors(new_builder, selected_subgraph, used_tensors_dic,
+ used_buffers_dic)
# Create input vector for subgraph table
new_input_tensor_num = len(new_input_tensor)
new_outputs = new_builder.EndVector(new_output_tensor_num)
# Operators
- operators = GenerateOperators(new_builder, selected_subgraph, opcode_list, used_tensors_dic)
+ operators = GenerateOperators(new_builder, selected_subgraph, opcode_list,
+ used_tensors_dic)
# Name
subgraph_name = selected_subgraph.Name()
return tflite.SubGraph.SubGraphEnd(new_builder)
-def GenerateSubgraphs(new_builder, sample_model, opcode_list, new_input_tensor, new_output_tensor, used_tensors_dic, used_buffers_dic):
+def GenerateSubgraphs(new_builder, sample_model, opcode_list, new_input_tensor,
+ new_output_tensor, used_tensors_dic, used_buffers_dic):
new_subgraph_list = []
# We think only main graph
selected_subgraph = sample_model.Subgraphs(0)
- new_subgraph = GenerateSubgraph(new_builder, selected_subgraph, opcode_list, new_input_tensor, new_output_tensor, used_tensors_dic, used_buffers_dic)
+ new_subgraph = GenerateSubgraph(new_builder, selected_subgraph, opcode_list,
+ new_input_tensor, new_output_tensor, used_tensors_dic,
+ used_buffers_dic)
new_subgraph_list.append(new_subgraph)
new_subgraph_num = 1
return new_builder.EndVector(new_subgraph_num)
+
def GenerateBuffers(new_builder, sample_model, used_buffers_dic):
buffer_num = sample_model.BuffersLength()
new_buffer_data_list = {}
return new_builder.EndVector(new_buffer_num)
-def GenerateModel(new_builder, sample_model, opcode_list, new_input_tensors, new_output_tensors, used_tensors_dic, used_buffers_dic):
+
+def GenerateModel(new_builder, sample_model, opcode_list, new_input_tensors,
+ new_output_tensors, used_tensors_dic, used_buffers_dic):
# uint
version = sample_model.Version()
operator_codes = GenerateOperatorCodes(new_builder, sample_model)
# subgraphs
- subgraphs = GenerateSubgraphs(new_builder, sample_model, opcode_list, new_input_tensors, new_output_tensors, used_tensors_dic, used_buffers_dic)
+ subgraphs = GenerateSubgraphs(new_builder, sample_model, opcode_list,
+ new_input_tensors, new_output_tensors, used_tensors_dic,
+ used_buffers_dic)
# description
description_string = new_builder.CreateString(sample_model.Description())
return tflite.Model.ModelEnd(new_builder)
+
def Finish(new_builder, new_model):
# Cusrom implementation: identifier
# Python API don't support identifier input yet
# Reference: Finish(self, rootTable)) in builder.py, Finish(uoffset_t root, const char *file_identifier, bool size_prefix) in flatbuffers.h
- new_builder.Prep(new_builder.minalign, flatbuffers.number_types.UOffsetTFlags.bytewidth)
+ new_builder.Prep(new_builder.minalign,
+ flatbuffers.number_types.UOffsetTFlags.bytewidth)
new_builder.PrependByte(0x33)
new_builder.PrependByte(0x4c)
new_builder.finished = True
return new_builder.Head()
+
def main(args):
input_model_file = args.input_model
oplist_file = args.opcode_list
# Create new model file
new_builder = flatbuffers.Builder(1024)
- new_model = GenerateModel(new_builder, sample_model, opcode_list, new_input_tensors, new_output_tensors, used_tensors_dic, used_buffers_dic)
+ new_model = GenerateModel(new_builder, sample_model, opcode_list, new_input_tensors,
+ new_output_tensors, used_tensors_dic, used_buffers_dic)
Finish(new_builder, new_model)
new_buf = new_builder.Output()
output_model_file.write(new_buf)
+
if __name__ == '__main__':
# Define argument and read
arg_parser = argparse.ArgumentParser()
- arg_parser.add_argument("input_model", type=argparse.FileType('rb'), help="input tflite model file to read")
- arg_parser.add_argument("opcode_list", type=argparse.FileType('r'), help="text file including selected operator list")
- arg_parser.add_argument("output_model", type=argparse.FileType('wb'), help="output tflite model file")
+ arg_parser.add_argument(
+ "input_model",
+ type=argparse.FileType('rb'),
+ help="input tflite model file to read")
+ arg_parser.add_argument(
+ "opcode_list",
+ type=argparse.FileType('r'),
+ help="text file including selected operator list")
+ arg_parser.add_argument(
+ "output_model", type=argparse.FileType('wb'), help="output tflite model file")
args = arg_parser.parse_args()
# Call main function
# namespace: tflite
+
class ActivationFunctionType(object):
NONE = 0
RELU = 1
RELU6 = 3
TANH = 4
SIGN_BIT = 5
-
import flatbuffers
+
class AddOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
-def AddOptionsStart(builder): builder.StartObject(1)
-def AddOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0)
-def AddOptionsEnd(builder): return builder.EndObject()
+
+def AddOptionsStart(builder):
+ builder.StartObject(1)
+
+
+def AddOptionsAddFusedActivationFunction(builder, fusedActivationFunction):
+ builder.PrependInt8Slot(0, fusedActivationFunction, 0)
+
+
+def AddOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class BatchToSpaceNDOptions(object):
__slots__ = ['_tab']
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
-def BatchToSpaceNDOptionsStart(builder): builder.StartObject(0)
-def BatchToSpaceNDOptionsEnd(builder): return builder.EndObject()
+
+def BatchToSpaceNDOptionsStart(builder):
+ builder.StartObject(0)
+
+
+def BatchToSpaceNDOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class BidirectionalSequenceRNNOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
-def BidirectionalSequenceRNNOptionsStart(builder): builder.StartObject(2)
-def BidirectionalSequenceRNNOptionsAddTimeMajor(builder, timeMajor): builder.PrependBoolSlot(0, timeMajor, 0)
-def BidirectionalSequenceRNNOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(1, fusedActivationFunction, 0)
-def BidirectionalSequenceRNNOptionsEnd(builder): return builder.EndObject()
+
+def BidirectionalSequenceRNNOptionsStart(builder):
+ builder.StartObject(2)
+
+
+def BidirectionalSequenceRNNOptionsAddTimeMajor(builder, timeMajor):
+ builder.PrependBoolSlot(0, timeMajor, 0)
+
+
+def BidirectionalSequenceRNNOptionsAddFusedActivationFunction(builder,
+ fusedActivationFunction):
+ builder.PrependInt8Slot(1, fusedActivationFunction, 0)
+
+
+def BidirectionalSequenceRNNOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class Buffer(object):
__slots__ = ['_tab']
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
+ return self._tab.Get(
+ flatbuffers.number_types.Uint8Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
return 0
# Buffer
return self._tab.VectorLen(o)
return 0
-def BufferStart(builder): builder.StartObject(1)
-def BufferAddData(builder, data): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(data), 0)
-def BufferStartDataVector(builder, numElems): return builder.StartVector(1, numElems, 1)
-def BufferEnd(builder): return builder.EndObject()
+
+def BufferStart(builder):
+ builder.StartObject(1)
+
+
+def BufferAddData(builder, data):
+ builder.PrependUOffsetTRelativeSlot(
+ 0, flatbuffers.number_types.UOffsetTFlags.py_type(data), 0)
+
+
+def BufferStartDataVector(builder, numElems):
+ return builder.StartVector(1, numElems, 1)
+
+
+def BufferEnd(builder):
+ return builder.EndObject()
# namespace: tflite
+
class BuiltinOperator(object):
ADD = 0
AVERAGE_POOL_2D = 1
DELEGATE = 51
BIDIRECTIONAL_SEQUENCE_LSTM = 52
CAST = 53
-
# namespace: tflite
+
class BuiltinOptions(object):
NONE = 0
Conv2DOptions = 1
LogSoftmaxOptions = 36
CastOptions = 37
DequantizeOptions = 38
-
import flatbuffers
+
class CallOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
return 0
-def CallOptionsStart(builder): builder.StartObject(1)
-def CallOptionsAddSubgraph(builder, subgraph): builder.PrependUint32Slot(0, subgraph, 0)
-def CallOptionsEnd(builder): return builder.EndObject()
+
+def CallOptionsStart(builder):
+ builder.StartObject(1)
+
+
+def CallOptionsAddSubgraph(builder, subgraph):
+ builder.PrependUint32Slot(0, subgraph, 0)
+
+
+def CallOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class CastOptions(object):
__slots__ = ['_tab']
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
-def CastOptionsStart(builder): builder.StartObject(0)
-def CastOptionsEnd(builder): return builder.EndObject()
+
+def CastOptionsStart(builder):
+ builder.StartObject(0)
+
+
+def CastOptionsEnd(builder):
+ return builder.EndObject()
# namespace: tflite
+
class CombinerType(object):
SUM = 0
MEAN = 1
SQRTN = 2
-
import flatbuffers
+
class ConcatEmbeddingsOptions(object):
__slots__ = ['_tab']
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
+ return self._tab.Get(
+ flatbuffers.number_types.Int32Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0
# ConcatEmbeddingsOptions
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
if o != 0:
a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
+ return self._tab.Get(
+ flatbuffers.number_types.Int32Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0
# ConcatEmbeddingsOptions
return self._tab.VectorLen(o)
return 0
-def ConcatEmbeddingsOptionsStart(builder): builder.StartObject(3)
-def ConcatEmbeddingsOptionsAddNumChannels(builder, numChannels): builder.PrependInt32Slot(0, numChannels, 0)
-def ConcatEmbeddingsOptionsAddNumColumnsPerChannel(builder, numColumnsPerChannel): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(numColumnsPerChannel), 0)
-def ConcatEmbeddingsOptionsStartNumColumnsPerChannelVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def ConcatEmbeddingsOptionsAddEmbeddingDimPerChannel(builder, embeddingDimPerChannel): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(embeddingDimPerChannel), 0)
-def ConcatEmbeddingsOptionsStartEmbeddingDimPerChannelVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def ConcatEmbeddingsOptionsEnd(builder): return builder.EndObject()
+
+def ConcatEmbeddingsOptionsStart(builder):
+ builder.StartObject(3)
+
+
+def ConcatEmbeddingsOptionsAddNumChannels(builder, numChannels):
+ builder.PrependInt32Slot(0, numChannels, 0)
+
+
+def ConcatEmbeddingsOptionsAddNumColumnsPerChannel(builder, numColumnsPerChannel):
+ builder.PrependUOffsetTRelativeSlot(
+ 1, flatbuffers.number_types.UOffsetTFlags.py_type(numColumnsPerChannel), 0)
+
+
+def ConcatEmbeddingsOptionsStartNumColumnsPerChannelVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def ConcatEmbeddingsOptionsAddEmbeddingDimPerChannel(builder, embeddingDimPerChannel):
+ builder.PrependUOffsetTRelativeSlot(
+ 2, flatbuffers.number_types.UOffsetTFlags.py_type(embeddingDimPerChannel), 0)
+
+
+def ConcatEmbeddingsOptionsStartEmbeddingDimPerChannelVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def ConcatEmbeddingsOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class ConcatenationOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
-def ConcatenationOptionsStart(builder): builder.StartObject(2)
-def ConcatenationOptionsAddAxis(builder, axis): builder.PrependInt32Slot(0, axis, 0)
-def ConcatenationOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(1, fusedActivationFunction, 0)
-def ConcatenationOptionsEnd(builder): return builder.EndObject()
+
+def ConcatenationOptionsStart(builder):
+ builder.StartObject(2)
+
+
+def ConcatenationOptionsAddAxis(builder, axis):
+ builder.PrependInt32Slot(0, axis, 0)
+
+
+def ConcatenationOptionsAddFusedActivationFunction(builder, fusedActivationFunction):
+ builder.PrependInt8Slot(1, fusedActivationFunction, 0)
+
+
+def ConcatenationOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class Conv2DOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
-def Conv2DOptionsStart(builder): builder.StartObject(4)
-def Conv2DOptionsAddPadding(builder, padding): builder.PrependInt8Slot(0, padding, 0)
-def Conv2DOptionsAddStrideW(builder, strideW): builder.PrependInt32Slot(1, strideW, 0)
-def Conv2DOptionsAddStrideH(builder, strideH): builder.PrependInt32Slot(2, strideH, 0)
-def Conv2DOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(3, fusedActivationFunction, 0)
-def Conv2DOptionsEnd(builder): return builder.EndObject()
+
+def Conv2DOptionsStart(builder):
+ builder.StartObject(4)
+
+
+def Conv2DOptionsAddPadding(builder, padding):
+ builder.PrependInt8Slot(0, padding, 0)
+
+
+def Conv2DOptionsAddStrideW(builder, strideW):
+ builder.PrependInt32Slot(1, strideW, 0)
+
+
+def Conv2DOptionsAddStrideH(builder, strideH):
+ builder.PrependInt32Slot(2, strideH, 0)
+
+
+def Conv2DOptionsAddFusedActivationFunction(builder, fusedActivationFunction):
+ builder.PrependInt8Slot(3, fusedActivationFunction, 0)
+
+
+def Conv2DOptionsEnd(builder):
+ return builder.EndObject()
# namespace: tflite
+
class CustomOptionsFormat(object):
FLEXBUFFERS = 0
-
import flatbuffers
+
class DepthwiseConv2DOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
-def DepthwiseConv2DOptionsStart(builder): builder.StartObject(5)
-def DepthwiseConv2DOptionsAddPadding(builder, padding): builder.PrependInt8Slot(0, padding, 0)
-def DepthwiseConv2DOptionsAddStrideW(builder, strideW): builder.PrependInt32Slot(1, strideW, 0)
-def DepthwiseConv2DOptionsAddStrideH(builder, strideH): builder.PrependInt32Slot(2, strideH, 0)
-def DepthwiseConv2DOptionsAddDepthMultiplier(builder, depthMultiplier): builder.PrependInt32Slot(3, depthMultiplier, 0)
-def DepthwiseConv2DOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(4, fusedActivationFunction, 0)
-def DepthwiseConv2DOptionsEnd(builder): return builder.EndObject()
+
+def DepthwiseConv2DOptionsStart(builder):
+ builder.StartObject(5)
+
+
+def DepthwiseConv2DOptionsAddPadding(builder, padding):
+ builder.PrependInt8Slot(0, padding, 0)
+
+
+def DepthwiseConv2DOptionsAddStrideW(builder, strideW):
+ builder.PrependInt32Slot(1, strideW, 0)
+
+
+def DepthwiseConv2DOptionsAddStrideH(builder, strideH):
+ builder.PrependInt32Slot(2, strideH, 0)
+
+
+def DepthwiseConv2DOptionsAddDepthMultiplier(builder, depthMultiplier):
+ builder.PrependInt32Slot(3, depthMultiplier, 0)
+
+
+def DepthwiseConv2DOptionsAddFusedActivationFunction(builder, fusedActivationFunction):
+ builder.PrependInt8Slot(4, fusedActivationFunction, 0)
+
+
+def DepthwiseConv2DOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class DequantizeOptions(object):
__slots__ = ['_tab']
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
-def DequantizeOptionsStart(builder): builder.StartObject(0)
-def DequantizeOptionsEnd(builder): return builder.EndObject()
+
+def DequantizeOptionsStart(builder):
+ builder.StartObject(0)
+
+
+def DequantizeOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class DivOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
-def DivOptionsStart(builder): builder.StartObject(1)
-def DivOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0)
-def DivOptionsEnd(builder): return builder.EndObject()
+
+def DivOptionsStart(builder):
+ builder.StartObject(1)
+
+
+def DivOptionsAddFusedActivationFunction(builder, fusedActivationFunction):
+ builder.PrependInt8Slot(0, fusedActivationFunction, 0)
+
+
+def DivOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class EmbeddingLookupSparseOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
-def EmbeddingLookupSparseOptionsStart(builder): builder.StartObject(1)
-def EmbeddingLookupSparseOptionsAddCombiner(builder, combiner): builder.PrependInt8Slot(0, combiner, 0)
-def EmbeddingLookupSparseOptionsEnd(builder): return builder.EndObject()
+
+def EmbeddingLookupSparseOptionsStart(builder):
+ builder.StartObject(1)
+
+
+def EmbeddingLookupSparseOptionsAddCombiner(builder, combiner):
+ builder.PrependInt8Slot(0, combiner, 0)
+
+
+def EmbeddingLookupSparseOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class ExpOptions(object):
__slots__ = ['_tab']
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
-def ExpOptionsStart(builder): builder.StartObject(0)
-def ExpOptionsEnd(builder): return builder.EndObject()
+
+def ExpOptionsStart(builder):
+ builder.StartObject(0)
+
+
+def ExpOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class FullyConnectedOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
-def FullyConnectedOptionsStart(builder): builder.StartObject(1)
-def FullyConnectedOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0)
-def FullyConnectedOptionsEnd(builder): return builder.EndObject()
+
+def FullyConnectedOptionsStart(builder):
+ builder.StartObject(1)
+
+
+def FullyConnectedOptionsAddFusedActivationFunction(builder, fusedActivationFunction):
+ builder.PrependInt8Slot(0, fusedActivationFunction, 0)
+
+
+def FullyConnectedOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class GatherOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
return 0
-def GatherOptionsStart(builder): builder.StartObject(1)
-def GatherOptionsAddAxis(builder, axis): builder.PrependInt32Slot(0, axis, 0)
-def GatherOptionsEnd(builder): return builder.EndObject()
+
+def GatherOptionsStart(builder):
+ builder.StartObject(1)
+
+
+def GatherOptionsAddAxis(builder, axis):
+ builder.PrependInt32Slot(0, axis, 0)
+
+
+def GatherOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class L2NormOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
-def L2NormOptionsStart(builder): builder.StartObject(1)
-def L2NormOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0)
-def L2NormOptionsEnd(builder): return builder.EndObject()
+
+def L2NormOptionsStart(builder):
+ builder.StartObject(1)
+
+
+def L2NormOptionsAddFusedActivationFunction(builder, fusedActivationFunction):
+ builder.PrependInt8Slot(0, fusedActivationFunction, 0)
+
+
+def L2NormOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class LSHProjectionOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
-def LSHProjectionOptionsStart(builder): builder.StartObject(1)
-def LSHProjectionOptionsAddType(builder, type): builder.PrependInt8Slot(0, type, 0)
-def LSHProjectionOptionsEnd(builder): return builder.EndObject()
+
+def LSHProjectionOptionsStart(builder):
+ builder.StartObject(1)
+
+
+def LSHProjectionOptionsAddType(builder, type):
+ builder.PrependInt8Slot(0, type, 0)
+
+
+def LSHProjectionOptionsEnd(builder):
+ return builder.EndObject()
# namespace: tflite
+
class LSHProjectionType(object):
UNKNOWN = 0
SPARSE = 1
DENSE = 2
-
import flatbuffers
+
class LSTMOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
return 0.0
-def LSTMOptionsStart(builder): builder.StartObject(3)
-def LSTMOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0)
-def LSTMOptionsAddCellClip(builder, cellClip): builder.PrependFloat32Slot(1, cellClip, 0.0)
-def LSTMOptionsAddProjClip(builder, projClip): builder.PrependFloat32Slot(2, projClip, 0.0)
-def LSTMOptionsEnd(builder): return builder.EndObject()
+
+def LSTMOptionsStart(builder):
+ builder.StartObject(3)
+
+
+def LSTMOptionsAddFusedActivationFunction(builder, fusedActivationFunction):
+ builder.PrependInt8Slot(0, fusedActivationFunction, 0)
+
+
+def LSTMOptionsAddCellClip(builder, cellClip):
+ builder.PrependFloat32Slot(1, cellClip, 0.0)
+
+
+def LSTMOptionsAddProjClip(builder, projClip):
+ builder.PrependFloat32Slot(2, projClip, 0.0)
+
+
+def LSTMOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class LocalResponseNormalizationOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
return 0.0
-def LocalResponseNormalizationOptionsStart(builder): builder.StartObject(4)
-def LocalResponseNormalizationOptionsAddRadius(builder, radius): builder.PrependInt32Slot(0, radius, 0)
-def LocalResponseNormalizationOptionsAddBias(builder, bias): builder.PrependFloat32Slot(1, bias, 0.0)
-def LocalResponseNormalizationOptionsAddAlpha(builder, alpha): builder.PrependFloat32Slot(2, alpha, 0.0)
-def LocalResponseNormalizationOptionsAddBeta(builder, beta): builder.PrependFloat32Slot(3, beta, 0.0)
-def LocalResponseNormalizationOptionsEnd(builder): return builder.EndObject()
+
+def LocalResponseNormalizationOptionsStart(builder):
+ builder.StartObject(4)
+
+
+def LocalResponseNormalizationOptionsAddRadius(builder, radius):
+ builder.PrependInt32Slot(0, radius, 0)
+
+
+def LocalResponseNormalizationOptionsAddBias(builder, bias):
+ builder.PrependFloat32Slot(1, bias, 0.0)
+
+
+def LocalResponseNormalizationOptionsAddAlpha(builder, alpha):
+ builder.PrependFloat32Slot(2, alpha, 0.0)
+
+
+def LocalResponseNormalizationOptionsAddBeta(builder, beta):
+ builder.PrependFloat32Slot(3, beta, 0.0)
+
+
+def LocalResponseNormalizationOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class LogSoftmaxOptions(object):
__slots__ = ['_tab']
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
-def LogSoftmaxOptionsStart(builder): builder.StartObject(0)
-def LogSoftmaxOptionsEnd(builder): return builder.EndObject()
+
+def LogSoftmaxOptionsStart(builder):
+ builder.StartObject(0)
+
+
+def LogSoftmaxOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class MeanOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)
return 0
-def MeanOptionsStart(builder): builder.StartObject(1)
-def MeanOptionsAddKeepDims(builder, keepDims): builder.PrependBoolSlot(0, keepDims, 0)
-def MeanOptionsEnd(builder): return builder.EndObject()
+
+def MeanOptionsStart(builder):
+ builder.StartObject(1)
+
+
+def MeanOptionsAddKeepDims(builder, keepDims):
+ builder.PrependBoolSlot(0, keepDims, 0)
+
+
+def MeanOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class Model(object):
__slots__ = ['_tab']
return self._tab.VectorLen(o)
return 0
-def ModelStart(builder): builder.StartObject(5)
-def ModelAddVersion(builder, version): builder.PrependUint32Slot(0, version, 0)
-def ModelAddOperatorCodes(builder, operatorCodes): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(operatorCodes), 0)
-def ModelStartOperatorCodesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def ModelAddSubgraphs(builder, subgraphs): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(subgraphs), 0)
-def ModelStartSubgraphsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def ModelAddDescription(builder, description): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(description), 0)
-def ModelAddBuffers(builder, buffers): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(buffers), 0)
-def ModelStartBuffersVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def ModelEnd(builder): return builder.EndObject()
+
+def ModelStart(builder):
+ builder.StartObject(5)
+
+
+def ModelAddVersion(builder, version):
+ builder.PrependUint32Slot(0, version, 0)
+
+
+def ModelAddOperatorCodes(builder, operatorCodes):
+ builder.PrependUOffsetTRelativeSlot(
+ 1, flatbuffers.number_types.UOffsetTFlags.py_type(operatorCodes), 0)
+
+
+def ModelStartOperatorCodesVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def ModelAddSubgraphs(builder, subgraphs):
+ builder.PrependUOffsetTRelativeSlot(
+ 2, flatbuffers.number_types.UOffsetTFlags.py_type(subgraphs), 0)
+
+
+def ModelStartSubgraphsVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def ModelAddDescription(builder, description):
+ builder.PrependUOffsetTRelativeSlot(
+ 3, flatbuffers.number_types.UOffsetTFlags.py_type(description), 0)
+
+
+def ModelAddBuffers(builder, buffers):
+ builder.PrependUOffsetTRelativeSlot(
+ 4, flatbuffers.number_types.UOffsetTFlags.py_type(buffers), 0)
+
+
+def ModelStartBuffersVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def ModelEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class MulOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
-def MulOptionsStart(builder): builder.StartObject(1)
-def MulOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0)
-def MulOptionsEnd(builder): return builder.EndObject()
+
+def MulOptionsStart(builder):
+ builder.StartObject(1)
+
+
+def MulOptionsAddFusedActivationFunction(builder, fusedActivationFunction):
+ builder.PrependInt8Slot(0, fusedActivationFunction, 0)
+
+
+def MulOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class Operator(object):
__slots__ = ['_tab']
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
+ return self._tab.Get(
+ flatbuffers.number_types.Int32Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0
# Operator
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
if o != 0:
a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
+ return self._tab.Get(
+ flatbuffers.number_types.Int32Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0
# Operator
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
if o != 0:
a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
+ return self._tab.Get(
+ flatbuffers.number_types.Uint8Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
return 0
# Operator
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
-def OperatorStart(builder): builder.StartObject(7)
-def OperatorAddOpcodeIndex(builder, opcodeIndex): builder.PrependUint32Slot(0, opcodeIndex, 0)
-def OperatorAddInputs(builder, inputs): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(inputs), 0)
-def OperatorStartInputsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def OperatorAddOutputs(builder, outputs): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(outputs), 0)
-def OperatorStartOutputsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def OperatorAddBuiltinOptionsType(builder, builtinOptionsType): builder.PrependUint8Slot(3, builtinOptionsType, 0)
-def OperatorAddBuiltinOptions(builder, builtinOptions): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(builtinOptions), 0)
-def OperatorAddCustomOptions(builder, customOptions): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(customOptions), 0)
-def OperatorStartCustomOptionsVector(builder, numElems): return builder.StartVector(1, numElems, 1)
-def OperatorAddCustomOptionsFormat(builder, customOptionsFormat): builder.PrependInt8Slot(6, customOptionsFormat, 0)
-def OperatorEnd(builder): return builder.EndObject()
+
+def OperatorStart(builder):
+ builder.StartObject(7)
+
+
+def OperatorAddOpcodeIndex(builder, opcodeIndex):
+ builder.PrependUint32Slot(0, opcodeIndex, 0)
+
+
+def OperatorAddInputs(builder, inputs):
+ builder.PrependUOffsetTRelativeSlot(
+ 1, flatbuffers.number_types.UOffsetTFlags.py_type(inputs), 0)
+
+
+def OperatorStartInputsVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def OperatorAddOutputs(builder, outputs):
+ builder.PrependUOffsetTRelativeSlot(
+ 2, flatbuffers.number_types.UOffsetTFlags.py_type(outputs), 0)
+
+
+def OperatorStartOutputsVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def OperatorAddBuiltinOptionsType(builder, builtinOptionsType):
+ builder.PrependUint8Slot(3, builtinOptionsType, 0)
+
+
+def OperatorAddBuiltinOptions(builder, builtinOptions):
+ builder.PrependUOffsetTRelativeSlot(
+ 4, flatbuffers.number_types.UOffsetTFlags.py_type(builtinOptions), 0)
+
+
+def OperatorAddCustomOptions(builder, customOptions):
+ builder.PrependUOffsetTRelativeSlot(
+ 5, flatbuffers.number_types.UOffsetTFlags.py_type(customOptions), 0)
+
+
+def OperatorStartCustomOptionsVector(builder, numElems):
+ return builder.StartVector(1, numElems, 1)
+
+
+def OperatorAddCustomOptionsFormat(builder, customOptionsFormat):
+ builder.PrependInt8Slot(6, customOptionsFormat, 0)
+
+
+def OperatorEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class OperatorCode(object):
__slots__ = ['_tab']
return self._tab.String(o + self._tab.Pos)
return bytes()
-def OperatorCodeStart(builder): builder.StartObject(2)
-def OperatorCodeAddBuiltinCode(builder, builtinCode): builder.PrependInt8Slot(0, builtinCode, 0)
-def OperatorCodeAddCustomCode(builder, customCode): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(customCode), 0)
-def OperatorCodeEnd(builder): return builder.EndObject()
+
+def OperatorCodeStart(builder):
+ builder.StartObject(2)
+
+
+def OperatorCodeAddBuiltinCode(builder, builtinCode):
+ builder.PrependInt8Slot(0, builtinCode, 0)
+
+
+def OperatorCodeAddCustomCode(builder, customCode):
+ builder.PrependUOffsetTRelativeSlot(
+ 1, flatbuffers.number_types.UOffsetTFlags.py_type(customCode), 0)
+
+
+def OperatorCodeEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class PadOptions(object):
__slots__ = ['_tab']
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
-def PadOptionsStart(builder): builder.StartObject(0)
-def PadOptionsEnd(builder): return builder.EndObject()
+
+def PadOptionsStart(builder):
+ builder.StartObject(0)
+
+
+def PadOptionsEnd(builder):
+ return builder.EndObject()
# namespace: tflite
+
class Padding(object):
SAME = 0
VALID = 1
-
import flatbuffers
+
class Pool2DOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
-def Pool2DOptionsStart(builder): builder.StartObject(6)
-def Pool2DOptionsAddPadding(builder, padding): builder.PrependInt8Slot(0, padding, 0)
-def Pool2DOptionsAddStrideW(builder, strideW): builder.PrependInt32Slot(1, strideW, 0)
-def Pool2DOptionsAddStrideH(builder, strideH): builder.PrependInt32Slot(2, strideH, 0)
-def Pool2DOptionsAddFilterWidth(builder, filterWidth): builder.PrependInt32Slot(3, filterWidth, 0)
-def Pool2DOptionsAddFilterHeight(builder, filterHeight): builder.PrependInt32Slot(4, filterHeight, 0)
-def Pool2DOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(5, fusedActivationFunction, 0)
-def Pool2DOptionsEnd(builder): return builder.EndObject()
+
+def Pool2DOptionsStart(builder):
+ builder.StartObject(6)
+
+
+def Pool2DOptionsAddPadding(builder, padding):
+ builder.PrependInt8Slot(0, padding, 0)
+
+
+def Pool2DOptionsAddStrideW(builder, strideW):
+ builder.PrependInt32Slot(1, strideW, 0)
+
+
+def Pool2DOptionsAddStrideH(builder, strideH):
+ builder.PrependInt32Slot(2, strideH, 0)
+
+
+def Pool2DOptionsAddFilterWidth(builder, filterWidth):
+ builder.PrependInt32Slot(3, filterWidth, 0)
+
+
+def Pool2DOptionsAddFilterHeight(builder, filterHeight):
+ builder.PrependInt32Slot(4, filterHeight, 0)
+
+
+def Pool2DOptionsAddFusedActivationFunction(builder, fusedActivationFunction):
+ builder.PrependInt8Slot(5, fusedActivationFunction, 0)
+
+
+def Pool2DOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class QuantizationParameters(object):
__slots__ = ['_tab']
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
+ return self._tab.Get(
+ flatbuffers.number_types.Float32Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0
# QuantizationParameters
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
+ return self._tab.Get(
+ flatbuffers.number_types.Float32Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0
# QuantizationParameters
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
if o != 0:
a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
+ return self._tab.Get(
+ flatbuffers.number_types.Float32Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0
# QuantizationParameters
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
if o != 0:
a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8))
+ return self._tab.Get(
+ flatbuffers.number_types.Int64Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8))
return 0
# QuantizationParameters
return self._tab.VectorLen(o)
return 0
-def QuantizationParametersStart(builder): builder.StartObject(4)
-def QuantizationParametersAddMin(builder, min): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(min), 0)
-def QuantizationParametersStartMinVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def QuantizationParametersAddMax(builder, max): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(max), 0)
-def QuantizationParametersStartMaxVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def QuantizationParametersAddScale(builder, scale): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(scale), 0)
-def QuantizationParametersStartScaleVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def QuantizationParametersAddZeroPoint(builder, zeroPoint): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(zeroPoint), 0)
-def QuantizationParametersStartZeroPointVector(builder, numElems): return builder.StartVector(8, numElems, 8)
-def QuantizationParametersEnd(builder): return builder.EndObject()
+
+def QuantizationParametersStart(builder):
+ builder.StartObject(4)
+
+
+def QuantizationParametersAddMin(builder, min):
+ builder.PrependUOffsetTRelativeSlot(
+ 0, flatbuffers.number_types.UOffsetTFlags.py_type(min), 0)
+
+
+def QuantizationParametersStartMinVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def QuantizationParametersAddMax(builder, max):
+ builder.PrependUOffsetTRelativeSlot(
+ 1, flatbuffers.number_types.UOffsetTFlags.py_type(max), 0)
+
+
+def QuantizationParametersStartMaxVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def QuantizationParametersAddScale(builder, scale):
+ builder.PrependUOffsetTRelativeSlot(
+ 2, flatbuffers.number_types.UOffsetTFlags.py_type(scale), 0)
+
+
+def QuantizationParametersStartScaleVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def QuantizationParametersAddZeroPoint(builder, zeroPoint):
+ builder.PrependUOffsetTRelativeSlot(
+ 3, flatbuffers.number_types.UOffsetTFlags.py_type(zeroPoint), 0)
+
+
+def QuantizationParametersStartZeroPointVector(builder, numElems):
+ return builder.StartVector(8, numElems, 8)
+
+
+def QuantizationParametersEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class RNNOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
-def RNNOptionsStart(builder): builder.StartObject(1)
-def RNNOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0)
-def RNNOptionsEnd(builder): return builder.EndObject()
+
+def RNNOptionsStart(builder):
+ builder.StartObject(1)
+
+
+def RNNOptionsAddFusedActivationFunction(builder, fusedActivationFunction):
+ builder.PrependInt8Slot(0, fusedActivationFunction, 0)
+
+
+def RNNOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class ReshapeOptions(object):
__slots__ = ['_tab']
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
+ return self._tab.Get(
+ flatbuffers.number_types.Int32Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0
# ReshapeOptions
return self._tab.VectorLen(o)
return 0
-def ReshapeOptionsStart(builder): builder.StartObject(1)
-def ReshapeOptionsAddNewShape(builder, newShape): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(newShape), 0)
-def ReshapeOptionsStartNewShapeVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def ReshapeOptionsEnd(builder): return builder.EndObject()
+
+def ReshapeOptionsStart(builder):
+ builder.StartObject(1)
+
+
+def ReshapeOptionsAddNewShape(builder, newShape):
+ builder.PrependUOffsetTRelativeSlot(
+ 0, flatbuffers.number_types.UOffsetTFlags.py_type(newShape), 0)
+
+
+def ReshapeOptionsStartNewShapeVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def ReshapeOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class ResizeBilinearOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)
return 0
-def ResizeBilinearOptionsStart(builder): builder.StartObject(3)
-def ResizeBilinearOptionsAddAlignCorners(builder, alignCorners): builder.PrependBoolSlot(2, alignCorners, 0)
-def ResizeBilinearOptionsEnd(builder): return builder.EndObject()
+
+def ResizeBilinearOptionsStart(builder):
+ builder.StartObject(3)
+
+
+def ResizeBilinearOptionsAddAlignCorners(builder, alignCorners):
+ builder.PrependBoolSlot(2, alignCorners, 0)
+
+
+def ResizeBilinearOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class SVDFOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
-def SVDFOptionsStart(builder): builder.StartObject(2)
-def SVDFOptionsAddRank(builder, rank): builder.PrependInt32Slot(0, rank, 0)
-def SVDFOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(1, fusedActivationFunction, 0)
-def SVDFOptionsEnd(builder): return builder.EndObject()
+
+def SVDFOptionsStart(builder):
+ builder.StartObject(2)
+
+
+def SVDFOptionsAddRank(builder, rank):
+ builder.PrependInt32Slot(0, rank, 0)
+
+
+def SVDFOptionsAddFusedActivationFunction(builder, fusedActivationFunction):
+ builder.PrependInt8Slot(1, fusedActivationFunction, 0)
+
+
+def SVDFOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class SequenceRNNOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
-def SequenceRNNOptionsStart(builder): builder.StartObject(2)
-def SequenceRNNOptionsAddTimeMajor(builder, timeMajor): builder.PrependBoolSlot(0, timeMajor, 0)
-def SequenceRNNOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(1, fusedActivationFunction, 0)
-def SequenceRNNOptionsEnd(builder): return builder.EndObject()
+
+def SequenceRNNOptionsStart(builder):
+ builder.StartObject(2)
+
+
+def SequenceRNNOptionsAddTimeMajor(builder, timeMajor):
+ builder.PrependBoolSlot(0, timeMajor, 0)
+
+
+def SequenceRNNOptionsAddFusedActivationFunction(builder, fusedActivationFunction):
+ builder.PrependInt8Slot(1, fusedActivationFunction, 0)
+
+
+def SequenceRNNOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class SkipGramOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)
return 0
-def SkipGramOptionsStart(builder): builder.StartObject(3)
-def SkipGramOptionsAddNgramSize(builder, ngramSize): builder.PrependInt32Slot(0, ngramSize, 0)
-def SkipGramOptionsAddMaxSkipSize(builder, maxSkipSize): builder.PrependInt32Slot(1, maxSkipSize, 0)
-def SkipGramOptionsAddIncludeAllNgrams(builder, includeAllNgrams): builder.PrependBoolSlot(2, includeAllNgrams, 0)
-def SkipGramOptionsEnd(builder): return builder.EndObject()
+
+def SkipGramOptionsStart(builder):
+ builder.StartObject(3)
+
+
+def SkipGramOptionsAddNgramSize(builder, ngramSize):
+ builder.PrependInt32Slot(0, ngramSize, 0)
+
+
+def SkipGramOptionsAddMaxSkipSize(builder, maxSkipSize):
+ builder.PrependInt32Slot(1, maxSkipSize, 0)
+
+
+def SkipGramOptionsAddIncludeAllNgrams(builder, includeAllNgrams):
+ builder.PrependBoolSlot(2, includeAllNgrams, 0)
+
+
+def SkipGramOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class SoftmaxOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
return 0.0
-def SoftmaxOptionsStart(builder): builder.StartObject(1)
-def SoftmaxOptionsAddBeta(builder, beta): builder.PrependFloat32Slot(0, beta, 0.0)
-def SoftmaxOptionsEnd(builder): return builder.EndObject()
+
+def SoftmaxOptionsStart(builder):
+ builder.StartObject(1)
+
+
+def SoftmaxOptionsAddBeta(builder, beta):
+ builder.PrependFloat32Slot(0, beta, 0.0)
+
+
+def SoftmaxOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class SpaceToBatchNDOptions(object):
__slots__ = ['_tab']
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
-def SpaceToBatchNDOptionsStart(builder): builder.StartObject(0)
-def SpaceToBatchNDOptionsEnd(builder): return builder.EndObject()
+
+def SpaceToBatchNDOptionsStart(builder):
+ builder.StartObject(0)
+
+
+def SpaceToBatchNDOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class SpaceToDepthOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
return 0
-def SpaceToDepthOptionsStart(builder): builder.StartObject(1)
-def SpaceToDepthOptionsAddBlockSize(builder, blockSize): builder.PrependInt32Slot(0, blockSize, 0)
-def SpaceToDepthOptionsEnd(builder): return builder.EndObject()
+
+def SpaceToDepthOptionsStart(builder):
+ builder.StartObject(1)
+
+
+def SpaceToDepthOptionsAddBlockSize(builder, blockSize):
+ builder.PrependInt32Slot(0, blockSize, 0)
+
+
+def SpaceToDepthOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class SplitOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
return 0
-def SplitOptionsStart(builder): builder.StartObject(1)
-def SplitOptionsAddNumSplits(builder, numSplits): builder.PrependInt32Slot(0, numSplits, 0)
-def SplitOptionsEnd(builder): return builder.EndObject()
+
+def SplitOptionsStart(builder):
+ builder.StartObject(1)
+
+
+def SplitOptionsAddNumSplits(builder, numSplits):
+ builder.PrependInt32Slot(0, numSplits, 0)
+
+
+def SplitOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class SqueezeOptions(object):
__slots__ = ['_tab']
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
+ return self._tab.Get(
+ flatbuffers.number_types.Int32Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0
# SqueezeOptions
return self._tab.VectorLen(o)
return 0
-def SqueezeOptionsStart(builder): builder.StartObject(1)
-def SqueezeOptionsAddSqueezeDims(builder, squeezeDims): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(squeezeDims), 0)
-def SqueezeOptionsStartSqueezeDimsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def SqueezeOptionsEnd(builder): return builder.EndObject()
+
+def SqueezeOptionsStart(builder):
+ builder.StartObject(1)
+
+
+def SqueezeOptionsAddSqueezeDims(builder, squeezeDims):
+ builder.PrependUOffsetTRelativeSlot(
+ 0, flatbuffers.number_types.UOffsetTFlags.py_type(squeezeDims), 0)
+
+
+def SqueezeOptionsStartSqueezeDimsVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def SqueezeOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class StridedSliceOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
return 0
-def StridedSliceOptionsStart(builder): builder.StartObject(5)
-def StridedSliceOptionsAddBeginMask(builder, beginMask): builder.PrependInt32Slot(0, beginMask, 0)
-def StridedSliceOptionsAddEndMask(builder, endMask): builder.PrependInt32Slot(1, endMask, 0)
-def StridedSliceOptionsAddEllipsisMask(builder, ellipsisMask): builder.PrependInt32Slot(2, ellipsisMask, 0)
-def StridedSliceOptionsAddNewAxisMask(builder, newAxisMask): builder.PrependInt32Slot(3, newAxisMask, 0)
-def StridedSliceOptionsAddShrinkAxisMask(builder, shrinkAxisMask): builder.PrependInt32Slot(4, shrinkAxisMask, 0)
-def StridedSliceOptionsEnd(builder): return builder.EndObject()
+
+def StridedSliceOptionsStart(builder):
+ builder.StartObject(5)
+
+
+def StridedSliceOptionsAddBeginMask(builder, beginMask):
+ builder.PrependInt32Slot(0, beginMask, 0)
+
+
+def StridedSliceOptionsAddEndMask(builder, endMask):
+ builder.PrependInt32Slot(1, endMask, 0)
+
+
+def StridedSliceOptionsAddEllipsisMask(builder, ellipsisMask):
+ builder.PrependInt32Slot(2, ellipsisMask, 0)
+
+
+def StridedSliceOptionsAddNewAxisMask(builder, newAxisMask):
+ builder.PrependInt32Slot(3, newAxisMask, 0)
+
+
+def StridedSliceOptionsAddShrinkAxisMask(builder, shrinkAxisMask):
+ builder.PrependInt32Slot(4, shrinkAxisMask, 0)
+
+
+def StridedSliceOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class SubGraph(object):
__slots__ = ['_tab']
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
+ return self._tab.Get(
+ flatbuffers.number_types.Int32Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0
# SubGraph
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
if o != 0:
a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
+ return self._tab.Get(
+ flatbuffers.number_types.Int32Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0
# SubGraph
return self._tab.String(o + self._tab.Pos)
return bytes()
-def SubGraphStart(builder): builder.StartObject(5)
-def SubGraphAddTensors(builder, tensors): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(tensors), 0)
-def SubGraphStartTensorsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def SubGraphAddInputs(builder, inputs): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(inputs), 0)
-def SubGraphStartInputsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def SubGraphAddOutputs(builder, outputs): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(outputs), 0)
-def SubGraphStartOutputsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def SubGraphAddOperators(builder, operators): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(operators), 0)
-def SubGraphStartOperatorsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def SubGraphAddName(builder, name): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
-def SubGraphEnd(builder): return builder.EndObject()
+
+def SubGraphStart(builder):
+ builder.StartObject(5)
+
+
+def SubGraphAddTensors(builder, tensors):
+ builder.PrependUOffsetTRelativeSlot(
+ 0, flatbuffers.number_types.UOffsetTFlags.py_type(tensors), 0)
+
+
+def SubGraphStartTensorsVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def SubGraphAddInputs(builder, inputs):
+ builder.PrependUOffsetTRelativeSlot(
+ 1, flatbuffers.number_types.UOffsetTFlags.py_type(inputs), 0)
+
+
+def SubGraphStartInputsVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def SubGraphAddOutputs(builder, outputs):
+ builder.PrependUOffsetTRelativeSlot(
+ 2, flatbuffers.number_types.UOffsetTFlags.py_type(outputs), 0)
+
+
+def SubGraphStartOutputsVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def SubGraphAddOperators(builder, operators):
+ builder.PrependUOffsetTRelativeSlot(
+ 3, flatbuffers.number_types.UOffsetTFlags.py_type(operators), 0)
+
+
+def SubGraphStartOperatorsVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def SubGraphAddName(builder, name):
+ builder.PrependUOffsetTRelativeSlot(
+ 4, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
+
+
+def SubGraphEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class SubOptions(object):
__slots__ = ['_tab']
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 0
-def SubOptionsStart(builder): builder.StartObject(1)
-def SubOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0)
-def SubOptionsEnd(builder): return builder.EndObject()
+
+def SubOptionsStart(builder):
+ builder.StartObject(1)
+
+
+def SubOptionsAddFusedActivationFunction(builder, fusedActivationFunction):
+ builder.PrependInt8Slot(0, fusedActivationFunction, 0)
+
+
+def SubOptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class Tensor(object):
__slots__ = ['_tab']
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
a = self._tab.Vector(o)
- return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
+ return self._tab.Get(
+ flatbuffers.number_types.Int32Flags,
+ a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0
# Tensor
return obj
return None
-def TensorStart(builder): builder.StartObject(5)
-def TensorAddShape(builder, shape): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(shape), 0)
-def TensorStartShapeVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def TensorAddType(builder, type): builder.PrependInt8Slot(1, type, 0)
-def TensorAddBuffer(builder, buffer): builder.PrependUint32Slot(2, buffer, 0)
-def TensorAddName(builder, name): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
-def TensorAddQuantization(builder, quantization): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(quantization), 0)
-def TensorEnd(builder): return builder.EndObject()
+
+def TensorStart(builder):
+ builder.StartObject(5)
+
+
+def TensorAddShape(builder, shape):
+ builder.PrependUOffsetTRelativeSlot(
+ 0, flatbuffers.number_types.UOffsetTFlags.py_type(shape), 0)
+
+
+def TensorStartShapeVector(builder, numElems):
+ return builder.StartVector(4, numElems, 4)
+
+
+def TensorAddType(builder, type):
+ builder.PrependInt8Slot(1, type, 0)
+
+
+def TensorAddBuffer(builder, buffer):
+ builder.PrependUint32Slot(2, buffer, 0)
+
+
+def TensorAddName(builder, name):
+ builder.PrependUOffsetTRelativeSlot(
+ 3, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
+
+
+def TensorAddQuantization(builder, quantization):
+ builder.PrependUOffsetTRelativeSlot(
+ 4, flatbuffers.number_types.UOffsetTFlags.py_type(quantization), 0)
+
+
+def TensorEnd(builder):
+ return builder.EndObject()
# namespace: tflite
+
class TensorType(object):
FLOAT32 = 0
FLOAT16 = 1
UINT8 = 3
INT64 = 4
STRING = 5
-
import flatbuffers
+
class TopKV2Options(object):
__slots__ = ['_tab']
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
-def TopKV2OptionsStart(builder): builder.StartObject(0)
-def TopKV2OptionsEnd(builder): return builder.EndObject()
+
+def TopKV2OptionsStart(builder):
+ builder.StartObject(0)
+
+
+def TopKV2OptionsEnd(builder):
+ return builder.EndObject()
import flatbuffers
+
class TransposeOptions(object):
__slots__ = ['_tab']
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
-def TransposeOptionsStart(builder): builder.StartObject(0)
-def TransposeOptionsEnd(builder): return builder.EndObject()
+
+def TransposeOptionsStart(builder):
+ builder.StartObject(0)
+
+
+def TransposeOptionsEnd(builder):
+ return builder.EndObject()