Przeglądaj źródła

Update flatbuffers.js

Lutz Roeder 1 rok temu
rodzic
commit
cf172336cb

Plik diff jest za duży
+ 175 - 175
source/armnn-schema.js


+ 89 - 89
source/circle-schema.js

@@ -26,13 +26,13 @@ circle.CustomQuantization = class CustomQuantization {
 
     static decode(reader, position) {
         const $ = new circle.CustomQuantization();
-        $.custom = reader.typedArray(position, 4, Uint8Array);
+        $.custom = reader.array(position, 4, Uint8Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new circle.CustomQuantization();
-        $.custom = reader.typedArray(json.custom, Uint8Array);
+        $.custom = reader.array(json.custom, Uint8Array);
         return $;
     }
 };
@@ -58,20 +58,20 @@ circle.QuantizationParameters = class QuantizationParameters {
 
     static decode(reader, position) {
         const $ = new circle.QuantizationParameters();
-        $.min = reader.typedArray(position, 4, Float32Array);
-        $.max = reader.typedArray(position, 6, Float32Array);
-        $.scale = reader.typedArray(position, 8, Float32Array);
+        $.min = reader.array(position, 4, Float32Array);
+        $.max = reader.array(position, 6, Float32Array);
+        $.scale = reader.array(position, 8, Float32Array);
         $.zero_point = reader.int64s_(position, 10);
-        $.details = reader.union(position, 12, circle.QuantizationDetails.decode);
+        $.details = reader.union(position, 12, circle.QuantizationDetails);
         $.quantized_dimension = reader.int32_(position, 16, 0);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new circle.QuantizationParameters();
-        $.min = reader.typedArray(json.min, Float32Array);
-        $.max = reader.typedArray(json.max, Float32Array);
-        $.scale = reader.typedArray(json.scale, Float32Array);
+        $.min = reader.array(json.min, Float32Array);
+        $.max = reader.array(json.max, Float32Array);
+        $.scale = reader.array(json.scale, Float32Array);
         $.zero_point = reader.array(json.zero_point);
         $.details = circle.QuantizationDetails.decodeText(reader, json.details, json.details_type);
         $.quantized_dimension = reader.value(json.quantized_dimension, 0);
@@ -88,13 +88,13 @@ circle.Int32Vector = class Int32Vector {
 
     static decode(reader, position) {
         const $ = new circle.Int32Vector();
-        $.values = reader.typedArray(position, 4, Int32Array);
+        $.values = reader.array(position, 4, Int32Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new circle.Int32Vector();
-        $.values = reader.typedArray(json.values, Int32Array);
+        $.values = reader.array(json.values, Int32Array);
         return $;
     }
 };
@@ -103,13 +103,13 @@ circle.Uint16Vector = class Uint16Vector {
 
     static decode(reader, position) {
         const $ = new circle.Uint16Vector();
-        $.values = reader.typedArray(position, 4, Uint16Array);
+        $.values = reader.array(position, 4, Uint16Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new circle.Uint16Vector();
-        $.values = reader.typedArray(json.values, Uint16Array);
+        $.values = reader.array(json.values, Uint16Array);
         return $;
     }
 };
@@ -118,13 +118,13 @@ circle.Uint8Vector = class Uint8Vector {
 
     static decode(reader, position) {
         const $ = new circle.Uint8Vector();
-        $.values = reader.typedArray(position, 4, Uint8Array);
+        $.values = reader.array(position, 4, Uint8Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new circle.Uint8Vector();
-        $.values = reader.typedArray(json.values, Uint8Array);
+        $.values = reader.array(json.values, Uint8Array);
         return $;
     }
 };
@@ -156,8 +156,8 @@ circle.DimensionMetadata = class DimensionMetadata {
         const $ = new circle.DimensionMetadata();
         $.format = reader.int8_(position, 4, 0);
         $.dense_size = reader.int32_(position, 6, 0);
-        $.array_segments = reader.union(position, 8, circle.SparseIndexVector.decode);
-        $.array_indices = reader.union(position, 12, circle.SparseIndexVector.decode);
+        $.array_segments = reader.union(position, 8, circle.SparseIndexVector);
+        $.array_indices = reader.union(position, 12, circle.SparseIndexVector);
         return $;
     }
 
@@ -175,17 +175,17 @@ circle.SparsityParameters = class SparsityParameters {
 
     static decode(reader, position) {
         const $ = new circle.SparsityParameters();
-        $.traversal_order = reader.typedArray(position, 4, Int32Array);
-        $.block_map = reader.typedArray(position, 6, Int32Array);
-        $.dim_metadata = reader.tableArray(position, 8, circle.DimensionMetadata.decode);
+        $.traversal_order = reader.array(position, 4, Int32Array);
+        $.block_map = reader.array(position, 6, Int32Array);
+        $.dim_metadata = reader.tables(position, 8, circle.DimensionMetadata);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new circle.SparsityParameters();
-        $.traversal_order = reader.typedArray(json.traversal_order, Int32Array);
-        $.block_map = reader.typedArray(json.block_map, Int32Array);
-        $.dim_metadata = reader.objectArray(json.dim_metadata, circle.DimensionMetadata.decodeText);
+        $.traversal_order = reader.array(json.traversal_order, Int32Array);
+        $.block_map = reader.array(json.block_map, Int32Array);
+        $.dim_metadata = reader.objects(json.dim_metadata, circle.DimensionMetadata);
         return $;
     }
 };
@@ -194,7 +194,7 @@ circle.VariantSubType = class VariantSubType {
 
     static decode(reader, position) {
         const $ = new circle.VariantSubType();
-        $.shape = reader.typedArray(position, 4, Int32Array);
+        $.shape = reader.array(position, 4, Int32Array);
         $.type = reader.int8_(position, 6, 0);
         $.has_rank = reader.bool_(position, 8, false);
         return $;
@@ -202,7 +202,7 @@ circle.VariantSubType = class VariantSubType {
 
     static decodeText(reader, json) {
         const $ = new circle.VariantSubType();
-        $.shape = reader.typedArray(json.shape, Int32Array);
+        $.shape = reader.array(json.shape, Int32Array);
         $.type = circle.TensorType[json.type];
         $.has_rank = reader.value(json.has_rank, false);
         return $;
@@ -213,31 +213,31 @@ circle.Tensor = class Tensor {
 
     static decode(reader, position) {
         const $ = new circle.Tensor();
-        $.shape = reader.typedArray(position, 4, Int32Array);
+        $.shape = reader.array(position, 4, Int32Array);
         $.type = reader.int8_(position, 6, 0);
         $.buffer = reader.uint32_(position, 8, 0);
         $.name = reader.string_(position, 10, null);
-        $.quantization = reader.table(position, 12, circle.QuantizationParameters.decode);
+        $.quantization = reader.table(position, 12, circle.QuantizationParameters);
         $.is_variable = reader.bool_(position, 14, false);
-        $.sparsity = reader.table(position, 16, circle.SparsityParameters.decode);
-        $.shape_signature = reader.typedArray(position, 18, Int32Array);
+        $.sparsity = reader.table(position, 16, circle.SparsityParameters);
+        $.shape_signature = reader.array(position, 18, Int32Array);
         $.has_rank = reader.bool_(position, 20, false);
-        $.variant_tensors = reader.tableArray(position, 22, circle.VariantSubType.decode);
+        $.variant_tensors = reader.tables(position, 22, circle.VariantSubType);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new circle.Tensor();
-        $.shape = reader.typedArray(json.shape, Int32Array);
+        $.shape = reader.array(json.shape, Int32Array);
         $.type = circle.TensorType[json.type];
         $.buffer = reader.value(json.buffer, 0);
         $.name = reader.value(json.name, null);
-        $.quantization = reader.object(json.quantization, circle.QuantizationParameters.decodeText);
+        $.quantization = reader.object(json.quantization, circle.QuantizationParameters);
         $.is_variable = reader.value(json.is_variable, false);
-        $.sparsity = reader.object(json.sparsity, circle.SparsityParameters.decodeText);
-        $.shape_signature = reader.typedArray(json.shape_signature, Int32Array);
+        $.sparsity = reader.object(json.sparsity, circle.SparsityParameters);
+        $.shape_signature = reader.array(json.shape_signature, Int32Array);
         $.has_rank = reader.value(json.has_rank, false);
-        $.variant_tensors = reader.objectArray(json.variant_tensors, circle.VariantSubType.decodeText);
+        $.variant_tensors = reader.objects(json.variant_tensors, circle.VariantSubType);
         return $;
     }
 };
@@ -836,7 +836,7 @@ circle.StablehloDotGeneralOptions = class StablehloDotGeneralOptions {
         $.rhs_batching_dimensions = reader.int64s_(position, 6);
         $.lhs_contracting_dimensions = reader.int64s_(position, 8);
         $.rhs_contracting_dimensions = reader.int64s_(position, 10);
-        $.precision_config = reader.typedArray(position, 12, Uint32Array);
+        $.precision_config = reader.array(position, 12, Uint32Array);
         return $;
     }
 
@@ -846,7 +846,7 @@ circle.StablehloDotGeneralOptions = class StablehloDotGeneralOptions {
         $.rhs_batching_dimensions = reader.array(json.rhs_batching_dimensions);
         $.lhs_contracting_dimensions = reader.array(json.lhs_contracting_dimensions);
         $.rhs_contracting_dimensions = reader.array(json.rhs_contracting_dimensions);
-        $.precision_config = reader.objectArray(json.precision_config, circle.StablehloPrecisionConfig.decodeText);
+        $.precision_config = reader.objects(json.precision_config, circle.StablehloPrecisionConfig);
         return $;
     }
 };
@@ -1033,8 +1033,8 @@ circle.StablehloCustomCallOptions = class StablehloCustomCallOptions {
         $.has_side_effect = reader.bool_(position, 6, false);
         $.backend_config = reader.string_(position, 8, null);
         $.api_version = reader.int32_(position, 10, 0);
-        $.called_computations = reader.typedArray(position, 12, Int32Array);
-        $.custom_attributes = reader.typedArray(position, 14, Uint8Array);
+        $.called_computations = reader.array(position, 12, Int32Array);
+        $.custom_attributes = reader.array(position, 14, Uint8Array);
         return $;
     }
 
@@ -1044,8 +1044,8 @@ circle.StablehloCustomCallOptions = class StablehloCustomCallOptions {
         $.has_side_effect = reader.value(json.has_side_effect, false);
         $.backend_config = reader.value(json.backend_config, null);
         $.api_version = reader.value(json.api_version, 0);
-        $.called_computations = reader.typedArray(json.called_computations, Int32Array);
-        $.custom_attributes = reader.typedArray(json.custom_attributes, Uint8Array);
+        $.called_computations = reader.array(json.called_computations, Int32Array);
+        $.custom_attributes = reader.array(json.custom_attributes, Uint8Array);
         return $;
     }
 };
@@ -1106,7 +1106,7 @@ circle.StablehloConvolutionOptions = class StablehloConvolutionOptions {
         $.output_spatial_dimensions = reader.int64s_(position, 30);
         $.feature_group_count = reader.int64_(position, 32, 0n);
         $.batch_group_count = reader.int64_(position, 34, 0n);
-        $.precision_config = reader.typedArray(position, 36, Uint32Array);
+        $.precision_config = reader.array(position, 36, Uint32Array);
         return $;
     }
 
@@ -1128,7 +1128,7 @@ circle.StablehloConvolutionOptions = class StablehloConvolutionOptions {
         $.output_spatial_dimensions = reader.array(json.output_spatial_dimensions);
         $.feature_group_count = reader.int64(json.feature_group_count, 0n);
         $.batch_group_count = reader.int64(json.batch_group_count, 0n);
-        $.precision_config = reader.objectArray(json.precision_config, circle.StablehloPrecisionConfig.decodeText);
+        $.precision_config = reader.objects(json.precision_config, circle.StablehloPrecisionConfig);
         return $;
     }
 };
@@ -1308,16 +1308,16 @@ circle.ConcatEmbeddingsOptions = class ConcatEmbeddingsOptions {
     static decode(reader, position) {
         const $ = new circle.ConcatEmbeddingsOptions();
         $.num_channels = reader.int32_(position, 4, 0);
-        $.num_columns_per_channel = reader.typedArray(position, 6, Int32Array);
-        $.embedding_dim_per_channel = reader.typedArray(position, 8, Int32Array);
+        $.num_columns_per_channel = reader.array(position, 6, Int32Array);
+        $.embedding_dim_per_channel = reader.array(position, 8, Int32Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new circle.ConcatEmbeddingsOptions();
         $.num_channels = reader.value(json.num_channels, 0);
-        $.num_columns_per_channel = reader.typedArray(json.num_columns_per_channel, Int32Array);
-        $.embedding_dim_per_channel = reader.typedArray(json.embedding_dim_per_channel, Int32Array);
+        $.num_columns_per_channel = reader.array(json.num_columns_per_channel, Int32Array);
+        $.embedding_dim_per_channel = reader.array(json.embedding_dim_per_channel, Int32Array);
         return $;
     }
 };
@@ -1709,13 +1709,13 @@ circle.ReshapeOptions = class ReshapeOptions {
 
     static decode(reader, position) {
         const $ = new circle.ReshapeOptions();
-        $.new_shape = reader.typedArray(position, 4, Int32Array);
+        $.new_shape = reader.array(position, 4, Int32Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new circle.ReshapeOptions();
-        $.new_shape = reader.typedArray(json.new_shape, Int32Array);
+        $.new_shape = reader.array(json.new_shape, Int32Array);
         return $;
     }
 };
@@ -1936,13 +1936,13 @@ circle.SqueezeOptions = class SqueezeOptions {
 
     static decode(reader, position) {
         const $ = new circle.SqueezeOptions();
-        $.squeeze_dims = reader.typedArray(position, 4, Int32Array);
+        $.squeeze_dims = reader.array(position, 4, Int32Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new circle.SqueezeOptions();
-        $.squeeze_dims = reader.typedArray(json.squeeze_dims, Int32Array);
+        $.squeeze_dims = reader.array(json.squeeze_dims, Int32Array);
         return $;
     }
 };
@@ -3005,13 +3005,13 @@ circle.BucketizeOptions = class BucketizeOptions {
 
     static decode(reader, position) {
         const $ = new circle.BucketizeOptions();
-        $.boundaries = reader.typedArray(position, 4, Float32Array);
+        $.boundaries = reader.array(position, 4, Float32Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new circle.BucketizeOptions();
-        $.boundaries = reader.typedArray(json.boundaries, Float32Array);
+        $.boundaries = reader.array(json.boundaries, Float32Array);
         return $;
     }
 };
@@ -3285,29 +3285,29 @@ circle.Operator = class Operator {
     static decode(reader, position) {
         const $ = new circle.Operator();
         $.opcode_index = reader.uint32_(position, 4, 0);
-        $.inputs = reader.typedArray(position, 6, Int32Array);
-        $.outputs = reader.typedArray(position, 8, Int32Array);
-        $.builtin_options = reader.union(position, 10, circle.BuiltinOptions.decode);
-        $.custom_options = reader.typedArray(position, 14, Uint8Array);
+        $.inputs = reader.array(position, 6, Int32Array);
+        $.outputs = reader.array(position, 8, Int32Array);
+        $.builtin_options = reader.union(position, 10, circle.BuiltinOptions);
+        $.custom_options = reader.array(position, 14, Uint8Array);
         $.custom_options_format = reader.int8_(position, 16, 0);
         $.mutating_variable_inputs = reader.bools_(position, 18);
-        $.intermediates = reader.typedArray(position, 20, Int32Array);
+        $.intermediates = reader.array(position, 20, Int32Array);
         $.large_custom_options_offset = reader.uint64_(position, 22, 0n);
         $.large_custom_options_size = reader.uint64_(position, 24, 0n);
-        $.builtin_options_2 = reader.union(position, 26, circle.BuiltinOptions2.decode);
+        $.builtin_options_2 = reader.union(position, 26, circle.BuiltinOptions2);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new circle.Operator();
         $.opcode_index = reader.value(json.opcode_index, 0);
-        $.inputs = reader.typedArray(json.inputs, Int32Array);
-        $.outputs = reader.typedArray(json.outputs, Int32Array);
+        $.inputs = reader.array(json.inputs, Int32Array);
+        $.outputs = reader.array(json.outputs, Int32Array);
         $.builtin_options = circle.BuiltinOptions.decodeText(reader, json.builtin_options, json.builtin_options_type);
-        $.custom_options = reader.typedArray(json.custom_options, Uint8Array);
+        $.custom_options = reader.array(json.custom_options, Uint8Array);
         $.custom_options_format = circle.CustomOptionsFormat[json.custom_options_format];
         $.mutating_variable_inputs = reader.array(json.mutating_variable_inputs);
-        $.intermediates = reader.typedArray(json.intermediates, Int32Array);
+        $.intermediates = reader.array(json.intermediates, Int32Array);
         $.large_custom_options_offset = reader.uint64(json.large_custom_options_offset, 0n);
         $.large_custom_options_size = reader.uint64(json.large_custom_options_size, 0n);
         $.builtin_options_2 = circle.BuiltinOptions2.decodeText(reader, json.builtin_options_2, json.builtin_options_2_type);
@@ -3319,10 +3319,10 @@ circle.SubGraph = class SubGraph {
 
     static decode(reader, position) {
         const $ = new circle.SubGraph();
-        $.tensors = reader.tableArray(position, 4, circle.Tensor.decode);
-        $.inputs = reader.typedArray(position, 6, Int32Array);
-        $.outputs = reader.typedArray(position, 8, Int32Array);
-        $.operators = reader.tableArray(position, 10, circle.Operator.decode);
+        $.tensors = reader.tables(position, 4, circle.Tensor);
+        $.inputs = reader.array(position, 6, Int32Array);
+        $.outputs = reader.array(position, 8, Int32Array);
+        $.operators = reader.tables(position, 10, circle.Operator);
         $.name = reader.string_(position, 12, null);
         $.deprecated_data_format = reader.int8_(position, 14, 0);
         return $;
@@ -3330,10 +3330,10 @@ circle.SubGraph = class SubGraph {
 
     static decodeText(reader, json) {
         const $ = new circle.SubGraph();
-        $.tensors = reader.objectArray(json.tensors, circle.Tensor.decodeText);
-        $.inputs = reader.typedArray(json.inputs, Int32Array);
-        $.outputs = reader.typedArray(json.outputs, Int32Array);
-        $.operators = reader.objectArray(json.operators, circle.Operator.decodeText);
+        $.tensors = reader.objects(json.tensors, circle.Tensor);
+        $.inputs = reader.array(json.inputs, Int32Array);
+        $.outputs = reader.array(json.outputs, Int32Array);
+        $.operators = reader.objects(json.operators, circle.Operator);
         $.name = reader.value(json.name, null);
         $.deprecated_data_format = circle.DataFormat[json.deprecated_data_format];
         return $;
@@ -3344,7 +3344,7 @@ circle.Buffer = class Buffer {
 
     static decode(reader, position) {
         const $ = new circle.Buffer();
-        $.data = reader.typedArray(position, 4, Uint8Array);
+        $.data = reader.array(position, 4, Uint8Array);
         $.offset = reader.uint64_(position, 6, 0n);
         $.size = reader.uint64_(position, 8, 0n);
         return $;
@@ -3352,7 +3352,7 @@ circle.Buffer = class Buffer {
 
     static decodeText(reader, json) {
         const $ = new circle.Buffer();
-        $.data = reader.typedArray(json.data, Uint8Array);
+        $.data = reader.array(json.data, Uint8Array);
         $.offset = reader.uint64(json.offset, 0n);
         $.size = reader.uint64(json.size, 0n);
         return $;
@@ -3397,8 +3397,8 @@ circle.SignatureDef = class SignatureDef {
 
     static decode(reader, position) {
         const $ = new circle.SignatureDef();
-        $.inputs = reader.tableArray(position, 4, circle.TensorMap.decode);
-        $.outputs = reader.tableArray(position, 6, circle.TensorMap.decode);
+        $.inputs = reader.tables(position, 4, circle.TensorMap);
+        $.outputs = reader.tables(position, 6, circle.TensorMap);
         $.signature_key = reader.string_(position, 8, null);
         $.deprecated_tag = reader.string_(position, 10, null);
         $.subgraph_index = reader.uint32_(position, 12, 0);
@@ -3407,8 +3407,8 @@ circle.SignatureDef = class SignatureDef {
 
     static decodeText(reader, json) {
         const $ = new circle.SignatureDef();
-        $.inputs = reader.objectArray(json.inputs, circle.TensorMap.decodeText);
-        $.outputs = reader.objectArray(json.outputs, circle.TensorMap.decodeText);
+        $.inputs = reader.objects(json.inputs, circle.TensorMap);
+        $.outputs = reader.objects(json.outputs, circle.TensorMap);
         $.signature_key = reader.value(json.signature_key, null);
         $.deprecated_tag = reader.value(json.deprecated_tag, null);
         $.subgraph_index = reader.value(json.subgraph_index, 0);
@@ -3433,26 +3433,26 @@ circle.Model = class Model {
     static decode(reader, position) {
         const $ = new circle.Model();
         $.version = reader.uint32_(position, 4, 0);
-        $.operator_codes = reader.tableArray(position, 6, circle.OperatorCode.decode);
-        $.subgraphs = reader.tableArray(position, 8, circle.SubGraph.decode);
+        $.operator_codes = reader.tables(position, 6, circle.OperatorCode);
+        $.subgraphs = reader.tables(position, 8, circle.SubGraph);
         $.description = reader.string_(position, 10, null);
-        $.buffers = reader.tableArray(position, 12, circle.Buffer.decode);
-        $.metadata_buffer = reader.typedArray(position, 14, Int32Array);
-        $.metadata = reader.tableArray(position, 16, circle.Metadata.decode);
-        $.signature_defs = reader.tableArray(position, 18, circle.SignatureDef.decode);
+        $.buffers = reader.tables(position, 12, circle.Buffer);
+        $.metadata_buffer = reader.array(position, 14, Int32Array);
+        $.metadata = reader.tables(position, 16, circle.Metadata);
+        $.signature_defs = reader.tables(position, 18, circle.SignatureDef);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new circle.Model();
         $.version = reader.value(json.version, 0);
-        $.operator_codes = reader.objectArray(json.operator_codes, circle.OperatorCode.decodeText);
-        $.subgraphs = reader.objectArray(json.subgraphs, circle.SubGraph.decodeText);
+        $.operator_codes = reader.objects(json.operator_codes, circle.OperatorCode);
+        $.subgraphs = reader.objects(json.subgraphs, circle.SubGraph);
         $.description = reader.value(json.description, null);
-        $.buffers = reader.objectArray(json.buffers, circle.Buffer.decodeText);
-        $.metadata_buffer = reader.typedArray(json.metadata_buffer, Int32Array);
-        $.metadata = reader.objectArray(json.metadata, circle.Metadata.decodeText);
-        $.signature_defs = reader.objectArray(json.signature_defs, circle.SignatureDef.decodeText);
+        $.buffers = reader.objects(json.buffers, circle.Buffer);
+        $.metadata_buffer = reader.array(json.metadata_buffer, Int32Array);
+        $.metadata = reader.objects(json.metadata, circle.Metadata);
+        $.signature_defs = reader.objects(json.signature_defs, circle.SignatureDef);
         return $;
     }
 };

+ 37 - 37
source/dlc-schema.js

@@ -8,10 +8,10 @@ dlc.v3.Model = class Model {
     static decode(reader, position) {
         const $ = new dlc.v3.Model();
         $.unk1 = reader.int32_(position, 4, 0);
-        $.nodes = reader.tableArray(position, 6, dlc.v3.Node.decode);
-        $.unk2 = reader.typedArray(position, 8, Int32Array);
-        $.unk3 = reader.typedArray(position, 10, Int32Array);
-        $.attributes = reader.tableArray(position, 12, dlc.v3.Attribute.decode);
+        $.nodes = reader.tables(position, 6, dlc.v3.Node);
+        $.unk2 = reader.array(position, 8, Int32Array);
+        $.unk3 = reader.array(position, 10, Int32Array);
+        $.attributes = reader.tables(position, 12, dlc.v3.Attribute);
         return $;
     }
 };
@@ -25,7 +25,7 @@ dlc.v3.Node = class Node {
         $.type = reader.string_(position, 8, null);
         $.inputs = reader.strings_(position, 10);
         $.outputs = reader.strings_(position, 12);
-        $.attributes = reader.tableArray(position, 14, dlc.v3.Attribute.decode);
+        $.attributes = reader.tables(position, 14, dlc.v3.Attribute);
         return $;
     }
 };
@@ -35,9 +35,9 @@ dlc.v3.Tensor = class Tensor {
     static decode(reader, position) {
         const $ = new dlc.v3.Tensor();
         $.name = reader.string_(position, 4, null);
-        $.shape = reader.typedArray(position, 6, Int32Array);
-        $.data = reader.table(position, 8, dlc.v3.TensorData.decode);
-        $.attributes = reader.tableArray(position, 10, dlc.v3.Attribute.decode);
+        $.shape = reader.array(position, 6, Int32Array);
+        $.data = reader.table(position, 8, dlc.v3.TensorData);
+        $.attributes = reader.tables(position, 10, dlc.v3.Attribute);
         return $;
     }
 };
@@ -47,8 +47,8 @@ dlc.v3.TensorData = class TensorData {
     static decode(reader, position) {
         const $ = new dlc.v3.TensorData();
         $.dtype = reader.uint8_(position, 4, 0);
-        $.bytes = reader.typedArray(position, 6, Uint8Array);
-        $.floats = reader.typedArray(position, 8, Float32Array);
+        $.bytes = reader.array(position, 6, Uint8Array);
+        $.floats = reader.array(position, 8, Float32Array);
         return $;
     }
 };
@@ -64,12 +64,12 @@ dlc.v3.Attribute = class Attribute {
         $.uint32_value = reader.uint32_(position, 12, 0);
         $.float32_value = reader.float32_(position, 14, 0);
         $.string_value = reader.string_(position, 16, null);
-        $.unk6 = reader.typedArray(position, 18, Int8Array);
-        $.byte_list = reader.typedArray(position, 20, Int8Array);
-        $.int32_list = reader.typedArray(position, 22, Int32Array);
-        $.float32_list = reader.typedArray(position, 24, Float32Array);
-        $.unk10 = reader.typedArray(position, 26, Int8Array);
-        $.attributes = reader.tableArray(position, 28, dlc.v3.Attribute.decode);
+        $.unk6 = reader.array(position, 18, Int8Array);
+        $.byte_list = reader.array(position, 20, Int8Array);
+        $.int32_list = reader.array(position, 22, Int32Array);
+        $.float32_list = reader.array(position, 24, Float32Array);
+        $.unk10 = reader.array(position, 26, Int8Array);
+        $.attributes = reader.tables(position, 28, dlc.v3.Attribute);
         return $;
     }
 };
@@ -83,7 +83,7 @@ dlc.v3.ModelParameters = class ModelParameters {
 
     static decode(reader, position) {
         const $ = new dlc.v3.ModelParameters();
-        $.nodes = reader.tableArray(position, 4, dlc.v3.NodeParameters.decode);
+        $.nodes = reader.tables(position, 4, dlc.v3.NodeParameters);
         return $;
     }
 };
@@ -93,7 +93,7 @@ dlc.v3.NodeParameters = class NodeParameters {
     static decode(reader, position) {
         const $ = new dlc.v3.NodeParameters();
         $.name = reader.string_(position, 4, null);
-        $.weights = reader.tableArray(position, 6, dlc.v3.Tensor.decode);
+        $.weights = reader.tables(position, 6, dlc.v3.Tensor);
         return $;
     }
 };
@@ -104,7 +104,7 @@ dlc.v4.Model = class Model {
 
     static decode(reader, position) {
         const $ = new dlc.v4.Model();
-        $.graphs = reader.tableArray(position, 4, dlc.v4.Graph.decode);
+        $.graphs = reader.tables(position, 4, dlc.v4.Graph);
         return $;
     }
 };
@@ -114,8 +114,8 @@ dlc.v4.Graph = class Graph {
     static decode(reader, position) {
         const $ = new dlc.v4.Graph();
         $.name = reader.string_(position, 4, null);
-        $.nodes = reader.tableArray(position, 6, dlc.v4.Node.decode);
-        $.tensors = reader.tableArray(position, 8, dlc.v4.Tensor.decode);
+        $.nodes = reader.tables(position, 6, dlc.v4.Node);
+        $.tensors = reader.tables(position, 8, dlc.v4.Tensor);
         return $;
     }
 };
@@ -128,7 +128,7 @@ dlc.v4.Node = class Node {
         $.type = reader.string_(position, 6, null);
         $.inputs = reader.strings_(position, 8);
         $.outputs = reader.strings_(position, 10);
-        $.attributes = reader.tableArray(position, 12, dlc.v4.Attribute.decode);
+        $.attributes = reader.tables(position, 12, dlc.v4.Attribute);
         return $;
     }
 };
@@ -140,8 +140,8 @@ dlc.v4.Attribute = class Attribute {
         $.name = reader.string_(position, 4, null);
         $.kind = reader.int32_(position, 6, 0);
         $.flag = reader.uint8_(position, 8, 0);
-        $.value = reader.table(position, 10, dlc.v4.Value.decode);
-        $.tensor = reader.table(position, 12, dlc.v4.Tensor.decode);
+        $.value = reader.table(position, 10, dlc.v4.Value);
+        $.tensor = reader.table(position, 12, dlc.v4.Tensor);
         return $;
     }
 };
@@ -165,9 +165,9 @@ dlc.v4.Tensor = class Tensor {
         $.unk1 = reader.uint32_(position, 4, 0);
         $.name = reader.string_(position, 6, null);
         $.location = reader.int32_(position, 8, 0);
-        $.shape = reader.typedArray(position, 10, Int32Array);
+        $.shape = reader.array(position, 10, Int32Array);
         $.unk2 = reader.int32_(position, 12, 0);
-        $.info = reader.table(position, 14, dlc.v4.TensorInfo.decode);
+        $.info = reader.table(position, 14, dlc.v4.TensorInfo);
         $.dtype = reader.int32_(position, 16, 0);
         $.output_dtype = reader.int32_(position, 18, 0);
         $.unk6 = reader.uint8_(position, 20, 0);
@@ -181,8 +181,8 @@ dlc.v4.TensorInfo = class TensorInfo {
         const $ = new dlc.v4.TensorInfo();
         $.i1 = reader.int32_(position, 4, 0);
         $.b1 = reader.uint8_(position, 6, 0);
-        $.a = reader.table(position, 8, dlc.v4.TensorInfo1.decode);
-        $.b = reader.table(position, 10, dlc.v4.TensorInfo2.decode);
+        $.a = reader.table(position, 8, dlc.v4.TensorInfo1);
+        $.b = reader.table(position, 10, dlc.v4.TensorInfo2);
         return $;
     }
 };
@@ -205,7 +205,7 @@ dlc.v4.TensorInfo2 = class TensorInfo2 {
     static decode(reader, position) {
         const $ = new dlc.v4.TensorInfo2();
         $.i1 = reader.int32_(position, 4, 0);
-        $.l = reader.tableArray(position, 6, dlc.v4.TensorInfo3.decode);
+        $.l = reader.tables(position, 6, dlc.v4.TensorInfo3);
         return $;
     }
 };
@@ -228,8 +228,8 @@ dlc.v4.ModelParameters64 = class ModelParameters64 {
 
     static decode(reader, position) {
         const $ = new dlc.v4.ModelParameters64();
-        $.buffers = reader.tableArray(position, 4, dlc.v4.Buffer.decode);
-        $.params = reader.typedArray(position, 6, Uint8Array);
+        $.buffers = reader.tables(position, 4, dlc.v4.Buffer);
+        $.params = reader.array(position, 6, Uint8Array);
         return $;
     }
 };
@@ -238,7 +238,7 @@ dlc.v4.ModelParameters = class ModelParameters {
 
     static decode(reader, position) {
         const $ = new dlc.v4.ModelParameters();
-        $.graphs = reader.tableArray(position, 4, dlc.v4.GraphParameters.decode);
+        $.graphs = reader.tables(position, 4, dlc.v4.GraphParameters);
         return $;
     }
 };
@@ -248,8 +248,8 @@ dlc.v4.GraphParameters = class GraphParameters {
     static decode(reader, position) {
         const $ = new dlc.v4.GraphParameters();
         $.name = reader.string_(position, 4, null);
-        $.tensors = reader.tableArray(position, 6, dlc.v4.TensorData.decode);
-        $.nodes = reader.tableArray(position, 8, dlc.v4.NodeParameters.decode);
+        $.tensors = reader.tables(position, 6, dlc.v4.TensorData);
+        $.nodes = reader.tables(position, 8, dlc.v4.NodeParameters);
         return $;
     }
 };
@@ -258,7 +258,7 @@ dlc.v4.NodeParameters = class NodeParameters {
 
     static decode(reader, position) {
         const $ = new dlc.v4.NodeParameters();
-        $.tensors = reader.tableArray(position, 4, dlc.v4.TensorData.decode);
+        $.tensors = reader.tables(position, 4, dlc.v4.TensorData);
         return $;
     }
 };
@@ -268,7 +268,7 @@ dlc.v4.TensorData = class TensorData {
     static decode(reader, position) {
         const $ = new dlc.v4.TensorData();
         $.name = reader.string_(position, 4, null);
-        $.bytes = reader.typedArray(position, 6, Uint8Array);
+        $.bytes = reader.array(position, 6, Uint8Array);
         return $;
     }
 };
@@ -277,7 +277,7 @@ dlc.v4.Buffer = class Buffer {
 
     static decode(reader, position) {
         const $ = new dlc.v4.Buffer();
-        $.bytes = reader.typedArray(position, 4, Uint8Array);
+        $.bytes = reader.array(position, 4, Uint8Array);
         return $;
     }
 };

+ 25 - 37
source/flatbuffers.js

@@ -201,24 +201,24 @@ flatbuffers.BinaryReader = class {
         return [];
     }
 
-    struct(position, offset, decode) {
+    struct(position, offset, type) {
         offset = this.__offset(position, offset);
-        return offset ? decode(this, position + offset) : null;
+        return offset ? type.decode(this, position + offset) : null;
     }
 
-    table(position, offset, decode) {
+    table(position, offset, type) {
         offset = this.__offset(position, offset);
-        return offset ? decode(this, this.__indirect(position + offset)) : null;
+        return offset ? type.decode(this, this.__indirect(position + offset)) : null;
     }
 
-    union(position, offset, decode) {
+    union(position, offset, type) {
         const type_offset = this.__offset(position, offset);
-        const type = type_offset ? this.uint8(position + type_offset) : 0;
+        const union_type = type_offset ? this.uint8(position + type_offset) : 0;
         offset = this.__offset(position, offset + 2);
-        return offset ? decode(this, this.__union(position + offset), type) : null;
+        return offset ? type.decode(this, this.__union(position + offset), union_type) : null;
     }
 
-    typedArray(position, offset, type) {
+    array(position, offset, type) {
         offset = this.__offset(position, offset);
         if (offset) {
             const length = this.__vector_len(position + offset);
@@ -229,26 +229,26 @@ flatbuffers.BinaryReader = class {
         return new type(0);
     }
 
-    unionArray(/* position, offset, decode */) {
+    unions(/* position, offset, decode */) {
         return new flatbuffers.Error('Not implemented.');
     }
 
-    structArray(position, offset, decode) {
+    structs(position, offset, type) {
         offset = this.__offset(position, offset);
         const length = offset ? this.__vector_len(position + offset) : 0;
         const list = new Array(length);
         for (let i = 0; i < length; i++) {
-            list[i] = decode(this, this.__vector(position + offset) + i * 8);
+            list[i] = type.decode(this, this.__vector(position + offset) + i * 8);
         }
         return list;
     }
 
-    tableArray(position, offset, decode) {
+    tables(position, offset, type) {
         offset = this.__offset(position, offset);
         const length = offset ? this.__vector_len(position + offset) : 0;
         const list = new Array(length);
         for (let i = 0; i < length; i++) {
-            list[i] = decode(this, this.__indirect(this.__vector(position + offset) + i * 4));
+            list[i] = type.decode(this, this.__indirect(this.__vector(position + offset) + i * 4));
         }
         return list;
     }
@@ -473,43 +473,31 @@ flatbuffers.TextReader = class {
         return obj === undefined ? defaultValue : obj;
     }
 
-    object(obj, decode) {
-        return obj === undefined ? obj : decode(this, obj);
+    object(obj, type) {
+        return obj === undefined ? obj : type.decodeText(this, obj);
     }
 
-    array(obj) {
+    array(obj, type) {
+        type = type || Array;
         if (Array.isArray(obj)) {
-            const target = new Array(obj.length);
-            for (let i = 0; i < obj.length; i++) {
-                target[i] = obj[i];
-            }
-            return target;
-        }
-        if (!obj) {
-            return [];
-        }
-        throw new flatbuffers.Error('Inalid value array.');
-    }
-
-    typedArray(obj, type) {
-        if (Array.isArray(obj)) {
-            const target = new type(obj.length);
-            for (let i = 0; i < obj.length; i++) {
+            const length = obj.length;
+            const target = new type(length);
+            for (let i = 0; i < length; i++) {
                 target[i] = obj[i];
             }
             return target;
         }
-        if (!obj) {
-            return new type(0);
+        if (obj) {
+            throw new flatbuffers.Error('Inalid value array.');
         }
-        throw new flatbuffers.Error('Inalid typed array.');
+        return new type(0);
     }
 
-    objectArray(obj, decode) {
+    objects(obj, type) {
         if (Array.isArray(obj)) {
             const target = new Array(obj.length);
             for (let i = 0; i < obj.length; i++) {
-                target[i] = decode(this, obj[i]);
+                target[i] = type.decodeText(this, obj[i]);
             }
             return target;
         }

+ 30 - 30
source/megengine-schema.js

@@ -54,7 +54,7 @@ mgb.serialization.fbs.DType = class DType {
     static decode(reader, position) {
         const $ = new mgb.serialization.fbs.DType();
         $.type = reader.int8_(position, 4, 0);
-        $.param = reader.union(position, 6, mgb.serialization.fbs.DTypeParam.decode);
+        $.param = reader.union(position, 6, mgb.serialization.fbs.DTypeParam);
         return $;
     }
 };
@@ -2048,9 +2048,9 @@ mgb.serialization.fbs.param.MGBAddUpdate = class MGBAddUpdate {
 
     static decode(reader, position) {
         const $ = new mgb.serialization.fbs.param.MGBAddUpdate();
-        $.alpha = reader.struct(position, 4, mgb.serialization.fbs.param.PersistentDTypeScalar.decode);
-        $.beta = reader.struct(position, 6, mgb.serialization.fbs.param.PersistentDTypeScalar.decode);
-        $.bias = reader.struct(position, 8, mgb.serialization.fbs.param.PersistentDTypeScalar.decode);
+        $.alpha = reader.struct(position, 4, mgb.serialization.fbs.param.PersistentDTypeScalar);
+        $.beta = reader.struct(position, 6, mgb.serialization.fbs.param.PersistentDTypeScalar);
+        $.bias = reader.struct(position, 8, mgb.serialization.fbs.param.PersistentDTypeScalar);
         return $;
     }
 };
@@ -2070,7 +2070,7 @@ mgb.serialization.fbs.param.Dimshuffle = class Dimshuffle {
 
     static decode(reader, position) {
         const $ = new mgb.serialization.fbs.param.Dimshuffle();
-        $.pattern = reader.typedArray(position, 4, Int32Array);
+        $.pattern = reader.array(position, 4, Int32Array);
         $.ndim = reader.uint32_(position, 6, 0);
         return $;
     }
@@ -2095,7 +2095,7 @@ mgb.serialization.fbs.param.AxisAddRemove = class AxisAddRemove {
 
     static decode(reader, position) {
         const $ = new mgb.serialization.fbs.param.AxisAddRemove();
-        $.desc = reader.structArray(position, 4, mgb.serialization.fbs.param.AxisDesc.decode);
+        $.desc = reader.structs(position, 4, mgb.serialization.fbs.param.AxisDesc);
         return $;
     }
 };
@@ -2128,7 +2128,7 @@ mgb.serialization.fbs.param.IndexDescMaskDump = class IndexDescMaskDump {
 
     static decode(reader, position) {
         const $ = new mgb.serialization.fbs.param.IndexDescMaskDump();
-        $.items = reader.structArray(position, 4, mgb.serialization.fbs.param.IndexDescMaskItem.decode);
+        $.items = reader.structs(position, 4, mgb.serialization.fbs.param.IndexDescMaskItem);
         return $;
     }
 };
@@ -2201,7 +2201,7 @@ mgb.serialization.fbs.v2.Blob = class Blob {
 
     static decode(reader, position) {
         const $ = new mgb.serialization.fbs.v2.Blob();
-        $.data = reader.typedArray(position, 4, Uint8Array);
+        $.data = reader.array(position, 4, Uint8Array);
         return $;
     }
 };
@@ -2211,11 +2211,11 @@ mgb.serialization.fbs.v2.Tensor = class Tensor {
     static decode(reader, position) {
         const $ = new mgb.serialization.fbs.v2.Tensor();
         $.name = reader.string_(position, 4, null);
-        $.shape = reader.typedArray(position, 6, Uint32Array);
-        $.comp_node = reader.table(position, 8, mgb.serialization.fbs.v2.CompNode.decode);
-        $.dtype = reader.table(position, 10, mgb.serialization.fbs.DType.decode);
-        $.format = reader.union(position, 12, mgb.serialization.fbs.v2.TensorFormat.decode);
-        $.data = reader.typedArray(position, 16, Uint8Array);
+        $.shape = reader.array(position, 6, Uint32Array);
+        $.comp_node = reader.table(position, 8, mgb.serialization.fbs.v2.CompNode);
+        $.dtype = reader.table(position, 10, mgb.serialization.fbs.DType);
+        $.format = reader.union(position, 12, mgb.serialization.fbs.v2.TensorFormat);
+        $.data = reader.array(position, 16, Uint8Array);
         return $;
     }
 };
@@ -2345,16 +2345,16 @@ mgb.serialization.fbs.v2.Operator = class Operator {
         $.type = reader.string_(position, 4, null);
         $.type_id = reader.uint64_(position, 6, 0n);
         $.name = reader.string_(position, 8, null);
-        $.param = reader.union(position, 10, mgb.serialization.fbs.v2.OperatorParam.decode);
-        $.additional_params = reader.unionArray(position, 14, mgb.serialization.fbs.v2.OperatorParam.decode);
-        $.inputs = reader.typedArray(position, 18, Uint32Array);
-        $.outputs = reader.typedArray(position, 20, Uint32Array);
-        $.comp_node = reader.tableArray(position, 22, mgb.serialization.fbs.v2.CompNode.decode);
-        $.output_dtype = reader.table(position, 24, mgb.serialization.fbs.DType.decode);
-        $.tensors = reader.tableArray(position, 26, mgb.serialization.fbs.v2.Tensor.decode);
+        $.param = reader.union(position, 10, mgb.serialization.fbs.v2.OperatorParam);
+        $.additional_params = reader.unions(position, 14, mgb.serialization.fbs.v2.OperatorParam);
+        $.inputs = reader.array(position, 18, Uint32Array);
+        $.outputs = reader.array(position, 20, Uint32Array);
+        $.comp_node = reader.tables(position, 22, mgb.serialization.fbs.v2.CompNode);
+        $.output_dtype = reader.table(position, 24, mgb.serialization.fbs.DType);
+        $.tensors = reader.tables(position, 26, mgb.serialization.fbs.v2.Tensor);
         $.opr_version = reader.uint32_(position, 28, 0);
         $.priority = reader.int32_(position, 30, 0);
-        $.custom_data = reader.tableArray(position, 32, mgb.serialization.fbs.v2.Blob.decode);
+        $.custom_data = reader.tables(position, 32, mgb.serialization.fbs.v2.Blob);
         return $;
     }
 };
@@ -2376,10 +2376,10 @@ mgb.serialization.fbs.v2.MiddleTensor = class MiddleTensor {
     static decode(reader, position) {
         const $ = new mgb.serialization.fbs.v2.MiddleTensor();
         $.name = reader.string_(position, 4, null);
-        $.shape = reader.typedArray(position, 6, Uint32Array);
-        $.comp_node = reader.table(position, 8, mgb.serialization.fbs.v2.CompNode.decode);
-        $.dtype = reader.table(position, 10, mgb.serialization.fbs.DType.decode);
-        $.format = reader.union(position, 12, mgb.serialization.fbs.v2.TensorFormat.decode);
+        $.shape = reader.array(position, 6, Uint32Array);
+        $.comp_node = reader.table(position, 8, mgb.serialization.fbs.v2.CompNode);
+        $.dtype = reader.table(position, 10, mgb.serialization.fbs.DType);
+        $.format = reader.union(position, 12, mgb.serialization.fbs.v2.TensorFormat);
         return $;
     }
 };
@@ -2418,12 +2418,12 @@ mgb.serialization.fbs.v2.Model = class Model {
         const $ = new mgb.serialization.fbs.v2.Model();
         $.mge_version = reader.uint32_(position, 4, 0);
         $.model_version = reader.uint32_(position, 6, 0);
-        $.oprs = reader.tableArray(position, 8, mgb.serialization.fbs.v2.Operator.decode);
-        $.middle_tensors = reader.tableArray(position, 10, mgb.serialization.fbs.v2.MiddleTensor.decode);
-        $.output_vars_idx = reader.tableArray(position, 12, mgb.serialization.fbs.v2.OutputVar.decode);
-        $.output_alias = reader.tableArray(position, 14, mgb.serialization.fbs.v2.OutputAlias.decode);
+        $.oprs = reader.tables(position, 8, mgb.serialization.fbs.v2.Operator);
+        $.middle_tensors = reader.tables(position, 10, mgb.serialization.fbs.v2.MiddleTensor);
+        $.output_vars_idx = reader.tables(position, 12, mgb.serialization.fbs.v2.OutputVar);
+        $.output_alias = reader.tables(position, 14, mgb.serialization.fbs.v2.OutputAlias);
         $.nr_shared_tensor = reader.uint32_(position, 16, 0);
-        $.metadata = reader.table(position, 18, mgb.serialization.fbs.v2.Metadata.decode);
+        $.metadata = reader.table(position, 18, mgb.serialization.fbs.v2.Metadata);
         return $;
     }
 };

+ 159 - 159
source/mnn-schema.js

@@ -46,14 +46,14 @@ MNN.Blob = class Blob {
 
     static decode(reader, position) {
         const $ = new MNN.Blob();
-        $.dims = reader.typedArray(position, 4, Int32Array);
+        $.dims = reader.array(position, 4, Int32Array);
         $.dataFormat = reader.int8_(position, 6, 0);
         $.dataType = reader.int32_(position, 8, 1);
-        $.uint8s = reader.typedArray(position, 10, Uint8Array);
-        $.int8s = reader.typedArray(position, 12, Int8Array);
-        $.int32s = reader.typedArray(position, 14, Int32Array);
+        $.uint8s = reader.array(position, 10, Uint8Array);
+        $.int8s = reader.array(position, 12, Int8Array);
+        $.int32s = reader.array(position, 14, Int32Array);
         $.int64s = reader.int64s_(position, 16);
-        $.float32s = reader.typedArray(position, 18, Float32Array);
+        $.float32s = reader.array(position, 18, Float32Array);
         $.strings = reader.strings_(position, 20);
         $.external = reader.int64s_(position, 22);
         return $;
@@ -65,10 +65,10 @@ MNN.ListValue = class ListValue {
     static decode(reader, position) {
         const $ = new MNN.ListValue();
         $.s = reader.strings_(position, 4);
-        $.i = reader.typedArray(position, 6, Int32Array);
-        $.f = reader.typedArray(position, 8, Float32Array);
+        $.i = reader.array(position, 6, Int32Array);
+        $.f = reader.array(position, 8, Float32Array);
         $.b = reader.bools_(position, 10);
-        $.type = reader.typedArray(position, 12, Int32Array);
+        $.type = reader.array(position, 12, Int32Array);
         return $;
     }
 };
@@ -83,9 +83,9 @@ MNN.Attribute = class Attribute {
         $.key = reader.string_(position, 10, null);
         $.type = reader.int32_(position, 12, 0);
         $.f = reader.float32_(position, 14, 0);
-        $.tensor = reader.table(position, 16, MNN.Blob.decode);
-        $.list = reader.table(position, 18, MNN.ListValue.decode);
-        $.func = reader.table(position, 20, MNN.NamedAttrList.decode);
+        $.tensor = reader.table(position, 16, MNN.Blob);
+        $.list = reader.table(position, 18, MNN.ListValue);
+        $.func = reader.table(position, 20, MNN.NamedAttrList);
         return $;
     }
 };
@@ -95,7 +95,7 @@ MNN.NamedAttrList = class NamedAttrList {
     static decode(reader, position) {
         const $ = new MNN.NamedAttrList();
         $.name = reader.string_(position, 4, null);
-        $.attr = reader.tableArray(position, 6, MNN.Attribute.decode);
+        $.attr = reader.tables(position, 6, MNN.Attribute);
         return $;
     }
 };
@@ -124,8 +124,8 @@ MNN.Convolution2DCommon = class Convolution2DCommon {
         $.inputCount = reader.int32_(position, 26, 0);
         $.relu = reader.bool_(position, 28, false);
         $.relu6 = reader.bool_(position, 30, false);
-        $.pads = reader.typedArray(position, 32, Int32Array);
-        $.outPads = reader.typedArray(position, 34, Int32Array);
+        $.pads = reader.array(position, 32, Int32Array);
+        $.outPads = reader.array(position, 34, Int32Array);
         $.hasOutputShape = reader.bool_(position, 36, false);
         return $;
     }
@@ -135,17 +135,17 @@ MNN.Convolution3DCommon = class Convolution3DCommon {
 
     static decode(reader, position) {
         const $ = new MNN.Convolution3DCommon();
-        $.dilates = reader.typedArray(position, 4, Int32Array);
-        $.strides = reader.typedArray(position, 6, Int32Array);
-        $.kernels = reader.typedArray(position, 8, Int32Array);
-        $.pads = reader.typedArray(position, 10, Int32Array);
+        $.dilates = reader.array(position, 4, Int32Array);
+        $.strides = reader.array(position, 6, Int32Array);
+        $.kernels = reader.array(position, 8, Int32Array);
+        $.pads = reader.array(position, 10, Int32Array);
         $.padMode = reader.int8_(position, 12, 0);
         $.inputCount = reader.int32_(position, 14, 0);
         $.outputCount = reader.int32_(position, 16, 0);
         $.relu = reader.bool_(position, 18, false);
         $.relu6 = reader.bool_(position, 20, false);
         $.group = reader.int32_(position, 22, 1);
-        $.outPads = reader.typedArray(position, 24, Int32Array);
+        $.outPads = reader.array(position, 24, Int32Array);
         $.hasOutputShape = reader.bool_(position, 26, false);
         return $;
     }
@@ -161,7 +161,7 @@ MNN.SparseCommon = class SparseCommon {
     static decode(reader, position) {
         const $ = new MNN.SparseCommon();
         $.method = reader.int8_(position, 4, 0);
-        $.args = reader.tableArray(position, 6, MNN.Attribute.decode);
+        $.args = reader.tables(position, 6, MNN.Attribute);
         return $;
     }
 };
@@ -170,8 +170,8 @@ MNN.IDSTQuan = class IDSTQuan {
 
     static decode(reader, position) {
         const $ = new MNN.IDSTQuan();
-        $.buffer = reader.typedArray(position, 4, Int8Array);
-        $.alpha = reader.typedArray(position, 6, Float32Array);
+        $.buffer = reader.array(position, 4, Int8Array);
+        $.alpha = reader.array(position, 6, Float32Array);
         $.type = reader.int32_(position, 8, 0);
         $.useInt32 = reader.bool_(position, 10, false);
         $.quantScale = reader.float32_(position, 12, 0);
@@ -183,7 +183,7 @@ MNN.IDSTQuan = class IDSTQuan {
         $.has_scaleInt = reader.bool_(position, 24, false);
         $.shapeInt32 = reader.bool_(position, 26, false);
         $.weightSize = reader.uint32_(position, 28, 0);
-        $.index = reader.typedArray(position, 30, Uint32Array);
+        $.index = reader.array(position, 30, Uint32Array);
         return $;
     }
 };
@@ -198,17 +198,17 @@ MNN.QuantizedFloatParam = class QuantizedFloatParam {
 
     static decode(reader, position) {
         const $ = new MNN.QuantizedFloatParam();
-        $.weight = reader.typedArray(position, 4, Int8Array);
-        $.bias = reader.typedArray(position, 6, Int32Array);
-        $.scale = reader.typedArray(position, 8, Float32Array);
-        $.tensorScale = reader.typedArray(position, 10, Float32Array);
+        $.weight = reader.array(position, 4, Int8Array);
+        $.bias = reader.array(position, 6, Int32Array);
+        $.scale = reader.array(position, 8, Float32Array);
+        $.tensorScale = reader.array(position, 10, Float32Array);
         $.method = reader.int8_(position, 12, 0);
         $.nbits = reader.int32_(position, 14, 8);
         $.zeroPoint = reader.int8_(position, 16, 0);
         $.outputZeroPoint = reader.int8_(position, 18, 0);
         $.clampMin = reader.int8_(position, 20, -128);
         $.clampMax = reader.int8_(position, 22, 127);
-        $.winogradAttr = reader.typedArray(position, 24, Int32Array);
+        $.winogradAttr = reader.array(position, 24, Int32Array);
         $.outputDataType = reader.int32_(position, 26, 6);
         return $;
     }
@@ -218,12 +218,12 @@ MNN.Convolution2D = class Convolution2D {
 
     static decode(reader, position) {
         const $ = new MNN.Convolution2D();
-        $.common = reader.table(position, 4, MNN.Convolution2DCommon.decode);
-        $.weight = reader.typedArray(position, 6, Float32Array);
-        $.bias = reader.typedArray(position, 8, Float32Array);
-        $.quanParameter = reader.table(position, 10, MNN.IDSTQuan.decode);
-        $.symmetricQuan = reader.table(position, 12, MNN.QuantizedFloatParam.decode);
-        $.sparseParameter = reader.table(position, 14, MNN.SparseCommon.decode);
+        $.common = reader.table(position, 4, MNN.Convolution2DCommon);
+        $.weight = reader.array(position, 6, Float32Array);
+        $.bias = reader.array(position, 8, Float32Array);
+        $.quanParameter = reader.table(position, 10, MNN.IDSTQuan);
+        $.symmetricQuan = reader.table(position, 12, MNN.QuantizedFloatParam);
+        $.sparseParameter = reader.table(position, 14, MNN.SparseCommon);
         $.external = reader.int64s_(position, 16);
         return $;
     }
@@ -233,9 +233,9 @@ MNN.Convolution3D = class Convolution3D {
 
     static decode(reader, position) {
         const $ = new MNN.Convolution3D();
-        $.common = reader.table(position, 4, MNN.Convolution3DCommon.decode);
-        $.weight = reader.typedArray(position, 6, Float32Array);
-        $.bias = reader.typedArray(position, 8, Float32Array);
+        $.common = reader.table(position, 4, MNN.Convolution3DCommon);
+        $.weight = reader.array(position, 6, Float32Array);
+        $.bias = reader.array(position, 8, Float32Array);
         $.external = reader.int64s_(position, 10);
         return $;
     }
@@ -248,11 +248,11 @@ MNN.InnerProduct = class InnerProduct {
         $.outputCount = reader.int32_(position, 4, 0);
         $.biasTerm = reader.int32_(position, 6, 0);
         $.weightSize = reader.int32_(position, 8, 0);
-        $.weight = reader.typedArray(position, 10, Float32Array);
-        $.bias = reader.typedArray(position, 12, Float32Array);
+        $.weight = reader.array(position, 10, Float32Array);
+        $.bias = reader.array(position, 12, Float32Array);
         $.axis = reader.int32_(position, 14, 0);
         $.transpose = reader.bool_(position, 16, false);
-        $.quanParameter = reader.table(position, 18, MNN.IDSTQuan.decode);
+        $.quanParameter = reader.table(position, 18, MNN.IDSTQuan);
         return $;
     }
 };
@@ -289,7 +289,7 @@ MNN.Pool = class Pool {
         $.padType = reader.int8_(position, 20, 0);
         $.dataType = reader.int32_(position, 22, 1);
         $.ceilModel = reader.bool_(position, 24, true);
-        $.pads = reader.typedArray(position, 26, Int32Array);
+        $.pads = reader.array(position, 26, Int32Array);
         $.countType = reader.int8_(position, 28, 0);
         return $;
     }
@@ -299,9 +299,9 @@ MNN.Pool3D = class Pool3D {
 
     static decode(reader, position) {
         const $ = new MNN.Pool3D();
-        $.strides = reader.typedArray(position, 4, Int32Array);
-        $.kernels = reader.typedArray(position, 6, Int32Array);
-        $.pads = reader.typedArray(position, 8, Int32Array);
+        $.strides = reader.array(position, 4, Int32Array);
+        $.kernels = reader.array(position, 6, Int32Array);
+        $.pads = reader.array(position, 8, Int32Array);
         $.type = reader.int8_(position, 10, 0);
         $.padType = reader.int8_(position, 12, 0);
         $.isGlobal = reader.bool_(position, 14, false);
@@ -333,7 +333,7 @@ MNN.PRelu = class PRelu {
     static decode(reader, position) {
         const $ = new MNN.PRelu();
         $.slopeCount = reader.int32_(position, 4, 0);
-        $.slope = reader.typedArray(position, 6, Float32Array);
+        $.slope = reader.array(position, 6, Float32Array);
         return $;
     }
 };
@@ -385,7 +385,7 @@ MNN.Input = class Input {
 
     static decode(reader, position) {
         const $ = new MNN.Input();
-        $.dims = reader.typedArray(position, 4, Int32Array);
+        $.dims = reader.array(position, 4, Int32Array);
         $.dtype = reader.int32_(position, 6, 1);
         $.dformat = reader.int8_(position, 8, 2);
         return $;
@@ -399,11 +399,11 @@ MNN.LSTM = class LSTM {
         $.outputCount = reader.int32_(position, 4, 0);
         $.weightSize = reader.int32_(position, 6, 0);
         $.clippingThreshold = reader.float32_(position, 8, 0);
-        $.weightI = reader.table(position, 10, MNN.Blob.decode);
-        $.weightH = reader.table(position, 12, MNN.Blob.decode);
-        $.bias = reader.table(position, 14, MNN.Blob.decode);
-        $.weightIQ = reader.table(position, 16, MNN.Blob.decode);
-        $.weightIA = reader.table(position, 18, MNN.Blob.decode);
+        $.weightI = reader.table(position, 10, MNN.Blob);
+        $.weightH = reader.table(position, 12, MNN.Blob);
+        $.bias = reader.table(position, 14, MNN.Blob);
+        $.weightIQ = reader.table(position, 16, MNN.Blob);
+        $.weightIA = reader.table(position, 18, MNN.Blob);
         $.quantScale = reader.float32_(position, 20, 0);
         return $;
     }
@@ -414,7 +414,7 @@ MNN.Slice = class Slice {
     static decode(reader, position) {
         const $ = new MNN.Slice();
         $.axis = reader.int32_(position, 4, 0);
-        $.slicePoints = reader.typedArray(position, 6, Int32Array);
+        $.slicePoints = reader.array(position, 6, Int32Array);
         $.sourceType = reader.int8_(position, 8, 0);
         return $;
     }
@@ -425,12 +425,12 @@ MNN.BatchNorm = class BatchNorm {
     static decode(reader, position) {
         const $ = new MNN.BatchNorm();
         $.channels = reader.int32_(position, 4, 0);
-        $.slopeData = reader.typedArray(position, 6, Float32Array);
-        $.meanData = reader.typedArray(position, 8, Float32Array);
-        $.varData = reader.typedArray(position, 10, Float32Array);
-        $.biasData = reader.typedArray(position, 12, Float32Array);
-        $.Adata = reader.typedArray(position, 14, Float32Array);
-        $.Bdata = reader.typedArray(position, 16, Float32Array);
+        $.slopeData = reader.array(position, 6, Float32Array);
+        $.meanData = reader.array(position, 8, Float32Array);
+        $.varData = reader.array(position, 10, Float32Array);
+        $.biasData = reader.array(position, 12, Float32Array);
+        $.Adata = reader.array(position, 14, Float32Array);
+        $.Bdata = reader.array(position, 16, Float32Array);
         $.epsilon = reader.float32_(position, 18, 0.001);
         return $;
     }
@@ -441,8 +441,8 @@ MNN.Scale = class Scale {
     static decode(reader, position) {
         const $ = new MNN.Scale();
         $.channels = reader.int32_(position, 4, 0);
-        $.scaleData = reader.typedArray(position, 6, Float32Array);
-        $.biasData = reader.typedArray(position, 8, Float32Array);
+        $.scaleData = reader.array(position, 6, Float32Array);
+        $.biasData = reader.array(position, 8, Float32Array);
         $.external = reader.int64s_(position, 10);
         return $;
     }
@@ -460,7 +460,7 @@ MNN.Eltwise = class Eltwise {
     static decode(reader, position) {
         const $ = new MNN.Eltwise();
         $.type = reader.int8_(position, 4, 0);
-        $.coeff = reader.typedArray(position, 6, Float32Array);
+        $.coeff = reader.array(position, 6, Float32Array);
         return $;
     }
 };
@@ -479,7 +479,7 @@ MNN.Permute = class Permute {
 
     static decode(reader, position) {
         const $ = new MNN.Permute();
-        $.dims = reader.typedArray(position, 4, Int32Array);
+        $.dims = reader.array(position, 4, Int32Array);
         return $;
     }
 };
@@ -488,7 +488,7 @@ MNN.Reshape = class Reshape {
 
     static decode(reader, position) {
         const $ = new MNN.Reshape();
-        $.dims = reader.typedArray(position, 4, Int32Array);
+        $.dims = reader.array(position, 4, Int32Array);
         $.dimType = reader.int8_(position, 6, 0);
         return $;
     }
@@ -537,9 +537,9 @@ MNN.Proposal = class Proposal {
         $.afterNmsTopN = reader.int32_(position, 10, 0);
         $.nmsThreshold = reader.float32_(position, 12, 0);
         $.minSize = reader.int32_(position, 14, 0);
-        $.ratios = reader.table(position, 16, MNN.Blob.decode);
-        $.scales = reader.table(position, 18, MNN.Blob.decode);
-        $.anchors = reader.table(position, 20, MNN.Blob.decode);
+        $.ratios = reader.table(position, 16, MNN.Blob);
+        $.scales = reader.table(position, 18, MNN.Blob);
+        $.anchors = reader.table(position, 20, MNN.Blob);
         return $;
     }
 };
@@ -590,10 +590,10 @@ MNN.PriorBox = class PriorBox {
 
     static decode(reader, position) {
         const $ = new MNN.PriorBox();
-        $.minSizes = reader.typedArray(position, 4, Float32Array);
-        $.maxSizes = reader.typedArray(position, 6, Float32Array);
-        $.aspectRatios = reader.typedArray(position, 8, Float32Array);
-        $.variances = reader.typedArray(position, 10, Float32Array);
+        $.minSizes = reader.array(position, 4, Float32Array);
+        $.maxSizes = reader.array(position, 6, Float32Array);
+        $.aspectRatios = reader.array(position, 8, Float32Array);
+        $.variances = reader.array(position, 10, Float32Array);
         $.flip = reader.bool_(position, 12, false);
         $.clip = reader.bool_(position, 14, false);
         $.imageWidth = reader.int32_(position, 16, 0);
@@ -612,7 +612,7 @@ MNN.Normalize = class Normalize {
         $.acrossSpatial = reader.int32_(position, 4, 0);
         $.channelShared = reader.int32_(position, 6, 0);
         $.eps = reader.float32_(position, 8, 0);
-        $.scale = reader.typedArray(position, 10, Float32Array);
+        $.scale = reader.array(position, 10, Float32Array);
         return $;
     }
 };
@@ -622,9 +622,9 @@ MNN.EltwiseInt8 = class EltwiseInt8 {
     static decode(reader, position) {
         const $ = new MNN.EltwiseInt8();
         $.type = reader.int8_(position, 4, 0);
-        $.inputQuan0 = reader.table(position, 6, MNN.QuantizedFloatParam.decode);
-        $.inputQuan1 = reader.table(position, 8, MNN.QuantizedFloatParam.decode);
-        $.outputQuan = reader.table(position, 10, MNN.QuantizedFloatParam.decode);
+        $.inputQuan0 = reader.table(position, 6, MNN.QuantizedFloatParam);
+        $.inputQuan1 = reader.table(position, 8, MNN.QuantizedFloatParam);
+        $.outputQuan = reader.table(position, 10, MNN.QuantizedFloatParam);
         return $;
     }
 };
@@ -711,7 +711,7 @@ MNN.SqueezeParam = class SqueezeParam {
 
     static decode(reader, position) {
         const $ = new MNN.SqueezeParam();
-        $.squeezeDims = reader.typedArray(position, 4, Int32Array);
+        $.squeezeDims = reader.array(position, 4, Int32Array);
         return $;
     }
 };
@@ -743,7 +743,7 @@ MNN.ReductionParam = class ReductionParam {
     static decode(reader, position) {
         const $ = new MNN.ReductionParam();
         $.operation = reader.int8_(position, 4, 0);
-        $.dim = reader.typedArray(position, 6, Int32Array);
+        $.dim = reader.array(position, 6, Int32Array);
         $.coeff = reader.float32_(position, 8, 0);
         $.keepDims = reader.bool_(position, 10, false);
         $.dType = reader.int32_(position, 12, 1);
@@ -851,7 +851,7 @@ MNN.UnaryOp = class UnaryOp {
         const $ = new MNN.UnaryOp();
         $.opType = reader.int32_(position, 4, 0);
         $.T = reader.int32_(position, 6, 0);
-        $.tableInt8 = reader.typedArray(position, 8, Int8Array);
+        $.tableInt8 = reader.array(position, 8, Int8Array);
         return $;
     }
 };
@@ -967,7 +967,7 @@ MNN.Crop = class Crop {
     static decode(reader, position) {
         const $ = new MNN.Crop();
         $.axis = reader.int32_(position, 4, 2);
-        $.offset = reader.typedArray(position, 6, Int32Array);
+        $.offset = reader.array(position, 6, Int32Array);
         return $;
     }
 };
@@ -976,8 +976,8 @@ MNN.SpaceBatch = class SpaceBatch {
 
     static decode(reader, position) {
         const $ = new MNN.SpaceBatch();
-        $.blockShape = reader.table(position, 4, MNN.Blob.decode);
-        $.padding = reader.table(position, 6, MNN.Blob.decode);
+        $.blockShape = reader.table(position, 4, MNN.Blob);
+        $.padding = reader.table(position, 6, MNN.Blob);
         return $;
     }
 };
@@ -989,8 +989,8 @@ MNN.MatMul = class MatMul {
         $.T = reader.int32_(position, 4, 0);
         $.transposeA = reader.bool_(position, 6, false);
         $.transposeB = reader.bool_(position, 8, false);
-        $.weight = reader.typedArray(position, 10, Float32Array);
-        $.bias = reader.typedArray(position, 12, Float32Array);
+        $.weight = reader.array(position, 10, Float32Array);
+        $.bias = reader.array(position, 12, Float32Array);
         return $;
     }
 };
@@ -999,7 +999,7 @@ MNN.MomentsParam = class MomentsParam {
 
     static decode(reader, position) {
         const $ = new MNN.MomentsParam();
-        $.dim = reader.typedArray(position, 4, Int32Array);
+        $.dim = reader.array(position, 4, Int32Array);
         $.keepDims = reader.bool_(position, 6, true);
         $.dType = reader.int32_(position, 8, 1);
         return $;
@@ -1014,16 +1014,16 @@ MNN.RNNParam = class RNNParam {
         $.isBidirectionalRNN = reader.bool_(position, 6, false);
         $.linearBeforeReset = reader.bool_(position, 8, false);
         $.keepAllOutputs = reader.bool_(position, 10, false);
-        $.fwGateWeight = reader.table(position, 12, MNN.Blob.decode);
-        $.fwGateBias = reader.table(position, 14, MNN.Blob.decode);
-        $.fwCandidateWeight = reader.table(position, 16, MNN.Blob.decode);
-        $.fwCandidateBias = reader.table(position, 18, MNN.Blob.decode);
-        $.fwRecurrentBias = reader.table(position, 20, MNN.Blob.decode);
-        $.bwGateWeight = reader.table(position, 22, MNN.Blob.decode);
-        $.bwGateBias = reader.table(position, 24, MNN.Blob.decode);
-        $.bwCandidateWeight = reader.table(position, 26, MNN.Blob.decode);
-        $.bwCandidateBias = reader.table(position, 28, MNN.Blob.decode);
-        $.bwRecurrentBias = reader.table(position, 30, MNN.Blob.decode);
+        $.fwGateWeight = reader.table(position, 12, MNN.Blob);
+        $.fwGateBias = reader.table(position, 14, MNN.Blob);
+        $.fwCandidateWeight = reader.table(position, 16, MNN.Blob);
+        $.fwCandidateBias = reader.table(position, 18, MNN.Blob);
+        $.fwRecurrentBias = reader.table(position, 20, MNN.Blob);
+        $.bwGateWeight = reader.table(position, 22, MNN.Blob);
+        $.bwGateBias = reader.table(position, 24, MNN.Blob);
+        $.bwCandidateWeight = reader.table(position, 26, MNN.Blob);
+        $.bwCandidateBias = reader.table(position, 28, MNN.Blob);
+        $.bwRecurrentBias = reader.table(position, 30, MNN.Blob);
         return $;
     }
 };
@@ -1074,7 +1074,7 @@ MNN.DetectionPostProcessParam = class DetectionPostProcessParam {
         $.iouThreshold = reader.float32_(position, 12, 0);
         $.numClasses = reader.int32_(position, 14, 0);
         $.useRegularNMS = reader.bool_(position, 16, false);
-        $.centerSizeEncoding = reader.typedArray(position, 18, Float32Array);
+        $.centerSizeEncoding = reader.array(position, 18, Float32Array);
         return $;
     }
 };
@@ -1109,10 +1109,10 @@ MNN.LayerNorm = class LayerNorm {
 
     static decode(reader, position) {
         const $ = new MNN.LayerNorm();
-        $.axis = reader.typedArray(position, 4, Int32Array);
+        $.axis = reader.array(position, 4, Int32Array);
         $.epsilon = reader.float32_(position, 6, 0);
-        $.gamma = reader.typedArray(position, 8, Float32Array);
-        $.beta = reader.typedArray(position, 10, Float32Array);
+        $.gamma = reader.array(position, 8, Float32Array);
+        $.beta = reader.array(position, 10, Float32Array);
         $.group = reader.int32_(position, 12, 1);
         $.external = reader.int64s_(position, 14);
         return $;
@@ -1125,8 +1125,8 @@ MNN.GroupNorm = class GroupNorm {
         const $ = new MNN.GroupNorm();
         $.axis = reader.int32_(position, 4, 0);
         $.epsilon = reader.float32_(position, 6, 0);
-        $.gamma = reader.typedArray(position, 8, Float32Array);
-        $.beta = reader.typedArray(position, 10, Float32Array);
+        $.gamma = reader.array(position, 8, Float32Array);
+        $.beta = reader.array(position, 10, Float32Array);
         $.group = reader.int32_(position, 12, 1);
         $.bSwish = reader.int32_(position, 14, 0);
         $.external = reader.int64s_(position, 16);
@@ -1153,7 +1153,7 @@ MNN.TensorArray = class TensorArray {
         const $ = new MNN.TensorArray();
         $.dynamic_size = reader.bool_(position, 4, false);
         $.identical_element_shapes = reader.bool_(position, 6, false);
-        $.element_shape = reader.typedArray(position, 8, Int32Array);
+        $.element_shape = reader.array(position, 8, Int32Array);
         $.T = reader.int32_(position, 10, 1);
         $.axis = reader.int32_(position, 12, 0);
         $.keepdims = reader.bool_(position, 14, true);
@@ -1198,9 +1198,9 @@ MNN.QuantizedAdd = class QuantizedAdd {
     static decode(reader, position) {
         const $ = new MNN.QuantizedAdd();
         $.activationType = reader.int8_(position, 4, 0);
-        $.input1QuantizedParam = reader.table(position, 6, MNN.QuantizedParam.decode);
-        $.input2QuantizedParam = reader.table(position, 8, MNN.QuantizedParam.decode);
-        $.outputQuantizedParam = reader.table(position, 10, MNN.QuantizedParam.decode);
+        $.input1QuantizedParam = reader.table(position, 6, MNN.QuantizedParam);
+        $.input2QuantizedParam = reader.table(position, 8, MNN.QuantizedParam);
+        $.outputQuantizedParam = reader.table(position, 10, MNN.QuantizedParam);
         return $;
     }
 };
@@ -1220,7 +1220,7 @@ MNN.Dequantize = class Dequantize {
 
     static decode(reader, position) {
         const $ = new MNN.Dequantize();
-        $.inputQuantizedParam = reader.table(position, 4, MNN.QuantizedParam.decode);
+        $.inputQuantizedParam = reader.table(position, 4, MNN.QuantizedParam);
         $.mode = reader.int8_(position, 6, 0);
         $.modelFormat = reader.int8_(position, 8, 0);
         $.type = reader.int32_(position, 10, 0);
@@ -1251,7 +1251,7 @@ MNN.QuantizedBiasAdd = class QuantizedBiasAdd {
 
     static decode(reader, position) {
         const $ = new MNN.QuantizedBiasAdd();
-        $.bias = reader.typedArray(position, 4, Int32Array);
+        $.bias = reader.array(position, 4, Int32Array);
         $.inputType = reader.int32_(position, 6, 0);
         $.max = reader.int32_(position, 8, 0);
         $.min = reader.int32_(position, 10, 0);
@@ -1266,9 +1266,9 @@ MNN.QuantizedConcat = class QuantizedConcat {
         const $ = new MNN.QuantizedConcat();
         $.activationType = reader.int8_(position, 4, 0);
         $.axis = reader.int32_(position, 6, 0);
-        $.inputScale = reader.typedArray(position, 8, Float32Array);
-        $.inputZeroPoint = reader.typedArray(position, 10, Int32Array);
-        $.outputQuantizedParam = reader.table(position, 12, MNN.QuantizedParam.decode);
+        $.inputScale = reader.array(position, 8, Float32Array);
+        $.inputZeroPoint = reader.array(position, 10, Int32Array);
+        $.outputQuantizedParam = reader.table(position, 12, MNN.QuantizedParam);
         return $;
     }
 };
@@ -1277,8 +1277,8 @@ MNN.QuantizedLogistic = class QuantizedLogistic {
 
     static decode(reader, position) {
         const $ = new MNN.QuantizedLogistic();
-        $.inputQuantizedParam = reader.table(position, 4, MNN.QuantizedParam.decode);
-        $.outputQuantizedParam = reader.table(position, 6, MNN.QuantizedParam.decode);
+        $.inputQuantizedParam = reader.table(position, 4, MNN.QuantizedParam);
+        $.outputQuantizedParam = reader.table(position, 6, MNN.QuantizedParam);
         return $;
     }
 };
@@ -1334,7 +1334,7 @@ MNN.QuantizedReshape = class QuantizedReshape {
 
     static decode(reader, position) {
         const $ = new MNN.QuantizedReshape();
-        $.dims = reader.typedArray(position, 4, Int32Array);
+        $.dims = reader.array(position, 4, Int32Array);
         $.modelFormat = reader.int8_(position, 6, 0);
         return $;
     }
@@ -1386,21 +1386,21 @@ MNN.TfQuantizedConv2D = class TfQuantizedConv2D {
 
     static decode(reader, position) {
         const $ = new MNN.TfQuantizedConv2D();
-        $.bias = reader.typedArray(position, 4, Int32Array);
+        $.bias = reader.array(position, 4, Int32Array);
         $.biasflag = reader.bool_(position, 6, false);
-        $.common = reader.table(position, 8, MNN.Convolution2DCommon.decode);
-        $.weight = reader.typedArray(position, 10, Uint8Array);
+        $.common = reader.table(position, 8, MNN.Convolution2DCommon);
+        $.weight = reader.array(position, 10, Uint8Array);
         $.activationType = reader.int8_(position, 12, 0);
         $.multiplier = reader.int32_(position, 14, 0);
         $.outMax = reader.int32_(position, 16, 0);
         $.outMin = reader.int32_(position, 18, 0);
         $.shift = reader.int32_(position, 20, 0);
-        $.biasQuantizedParam = reader.table(position, 22, MNN.QuantizedParam.decode);
+        $.biasQuantizedParam = reader.table(position, 22, MNN.QuantizedParam);
         $.depthMultiplier = reader.int32_(position, 24, 0);
-        $.filterQuantizedParam = reader.table(position, 26, MNN.QuantizedParam.decode);
-        $.inputQuantizedParam = reader.table(position, 28, MNN.QuantizedParam.decode);
+        $.filterQuantizedParam = reader.table(position, 26, MNN.QuantizedParam);
+        $.inputQuantizedParam = reader.table(position, 28, MNN.QuantizedParam);
         $.modelFormat = reader.int8_(position, 30, 0);
-        $.outputQuantizedParam = reader.table(position, 32, MNN.QuantizedParam.decode);
+        $.outputQuantizedParam = reader.table(position, 32, MNN.QuantizedParam);
         return $;
     }
 };
@@ -1409,7 +1409,7 @@ MNN.ExtraInfo = class ExtraInfo {
 
     static decode(reader, position) {
         const $ = new MNN.ExtraInfo();
-        $.buffer = reader.typedArray(position, 4, Int8Array);
+        $.buffer = reader.array(position, 4, Int8Array);
         $.name = reader.string_(position, 6, null);
         $.version = reader.string_(position, 8, null);
         return $;
@@ -1488,11 +1488,11 @@ MNN.ImageProcessParam = class ImageProcessParam {
         $.sourceFormat = reader.int32_(position, 6, 0);
         $.destFormat = reader.int32_(position, 8, 0);
         $.wrap = reader.int8_(position, 10, 0);
-        $.mean = reader.typedArray(position, 12, Float32Array);
-        $.normal = reader.typedArray(position, 14, Float32Array);
-        $.transform = reader.typedArray(position, 16, Float32Array);
+        $.mean = reader.array(position, 12, Float32Array);
+        $.normal = reader.array(position, 14, Float32Array);
+        $.transform = reader.array(position, 16, Float32Array);
         $.paddingValue = reader.int8_(position, 18, 0);
-        $.shape = reader.typedArray(position, 20, Int32Array);
+        $.shape = reader.array(position, 20, Int32Array);
         $.outputType = reader.int32_(position, 22, 0);
         $.draw = reader.bool_(position, 24, false);
         return $;
@@ -1687,7 +1687,7 @@ MNN.Plugin = class Plugin {
     static decode(reader, position) {
         const $ = new MNN.Plugin();
         $.type = reader.string_(position, 4, null);
-        $.attr = reader.tableArray(position, 6, MNN.Attribute.decode);
+        $.attr = reader.tables(position, 6, MNN.Attribute);
         return $;
     }
 };
@@ -1698,8 +1698,8 @@ MNN.Extra = class Extra {
         const $ = new MNN.Extra();
         $.type = reader.string_(position, 4, null);
         $.engine = reader.string_(position, 6, null);
-        $.info = reader.typedArray(position, 8, Int8Array);
-        $.attr = reader.tableArray(position, 10, MNN.Attribute.decode);
+        $.info = reader.array(position, 8, Int8Array);
+        $.attr = reader.tables(position, 10, MNN.Attribute);
         $.vector = reader.bool_(position, 12, false);
         return $;
     }
@@ -1738,9 +1738,9 @@ MNN.WhileParam = class WhileParam {
         const $ = new MNN.WhileParam();
         $.cond_graph = reader.string_(position, 4, null);
         $.body_graph = reader.string_(position, 6, null);
-        $.aliases_inputs = reader.tableArray(position, 8, MNN.StringVec.decode);
+        $.aliases_inputs = reader.tables(position, 8, MNN.StringVec);
         $.aliases_outputs = reader.strings_(position, 10);
-        $.aliases_updates = reader.tableArray(position, 12, MNN.StringVec.decode);
+        $.aliases_updates = reader.tables(position, 12, MNN.StringVec);
         return $;
     }
 };
@@ -1751,8 +1751,8 @@ MNN.IfParam = class IfParam {
         const $ = new MNN.IfParam();
         $.then_graph = reader.string_(position, 4, null);
         $.else_graph = reader.string_(position, 6, null);
-        $.aliases_inputs = reader.tableArray(position, 8, MNN.StringVec.decode);
-        $.aliases_outputs = reader.tableArray(position, 10, MNN.StringVec.decode);
+        $.aliases_inputs = reader.tables(position, 8, MNN.StringVec);
+        $.aliases_outputs = reader.tables(position, 10, MNN.StringVec);
         return $;
     }
 };
@@ -1761,13 +1761,13 @@ MNN.RegionCommand = class RegionCommand {
 
     static decode(reader, position) {
         const $ = new MNN.RegionCommand();
-        $.op = reader.table(position, 4, MNN.Op.decode);
-        $.steps = reader.typedArray(position, 6, Int32Array);
-        $.size = reader.typedArray(position, 8, Int32Array);
-        $.indexes = reader.typedArray(position, 10, Int32Array);
-        $.view = reader.tableArray(position, 12, MNN.View.decode);
+        $.op = reader.table(position, 4, MNN.Op);
+        $.steps = reader.array(position, 6, Int32Array);
+        $.size = reader.array(position, 8, Int32Array);
+        $.indexes = reader.array(position, 10, Int32Array);
+        $.view = reader.tables(position, 12, MNN.View);
         $.fuse = reader.int32_(position, 14, -1);
-        $.iterIndexes = reader.typedArray(position, 16, Int32Array);
+        $.iterIndexes = reader.array(position, 16, Int32Array);
         return $;
     }
 };
@@ -1777,13 +1777,13 @@ MNN.LoopParam = class LoopParam {
     static decode(reader, position) {
         const $ = new MNN.LoopParam();
         $.tensorNumber = reader.int32_(position, 4, 0);
-        $.outputIndexes = reader.typedArray(position, 6, Int32Array);
-        $.inputIndexes = reader.typedArray(position, 8, Int32Array);
-        $.extraTensorInfos = reader.tableArray(position, 10, MNN.TensorDescribe.decode);
+        $.outputIndexes = reader.array(position, 6, Int32Array);
+        $.inputIndexes = reader.array(position, 8, Int32Array);
+        $.extraTensorInfos = reader.tables(position, 10, MNN.TensorDescribe);
         $.parallel = reader.bool_(position, 12, true);
         $.loopNumber = reader.int32_(position, 14, 0);
-        $.commands = reader.tableArray(position, 16, MNN.RegionCommand.decode);
-        $.initCommand = reader.tableArray(position, 18, MNN.RegionCommand.decode);
+        $.commands = reader.tables(position, 16, MNN.RegionCommand);
+        $.initCommand = reader.tables(position, 18, MNN.RegionCommand);
         return $;
     }
 };
@@ -1898,10 +1898,10 @@ MNN.Op = class Op {
 
     static decode(reader, position) {
         const $ = new MNN.Op();
-        $.inputIndexes = reader.typedArray(position, 4, Int32Array);
-        $.main = reader.union(position, 6, MNN.OpParameter.decode);
+        $.inputIndexes = reader.array(position, 4, Int32Array);
+        $.main = reader.union(position, 6, MNN.OpParameter);
         $.name = reader.string_(position, 10, null);
-        $.outputIndexes = reader.typedArray(position, 12, Int32Array);
+        $.outputIndexes = reader.array(position, 12, Int32Array);
         $.type = reader.int32_(position, 14, 0);
         $.defaultDimentionFormat = reader.int8_(position, 16, 1);
         return $;
@@ -1913,7 +1913,7 @@ MNN.View = class View {
     static decode(reader, position) {
         const $ = new MNN.View();
         $.offset = reader.int32_(position, 4, 0);
-        $.stride = reader.typedArray(position, 6, Int32Array);
+        $.stride = reader.array(position, 6, Int32Array);
         return $;
     }
 };
@@ -1922,9 +1922,9 @@ MNN.Region = class Region {
 
     static decode(reader, position) {
         const $ = new MNN.Region();
-        $.src = reader.table(position, 4, MNN.View.decode);
-        $.dst = reader.table(position, 6, MNN.View.decode);
-        $.size = reader.typedArray(position, 8, Int32Array);
+        $.src = reader.table(position, 4, MNN.View);
+        $.dst = reader.table(position, 6, MNN.View);
+        $.size = reader.array(position, 8, Int32Array);
         $.origin = reader.int32_(position, 10, 0);
         return $;
     }
@@ -1934,11 +1934,11 @@ MNN.TensorDescribe = class TensorDescribe {
 
     static decode(reader, position) {
         const $ = new MNN.TensorDescribe();
-        $.blob = reader.table(position, 4, MNN.Blob.decode);
+        $.blob = reader.table(position, 4, MNN.Blob);
         $.index = reader.int32_(position, 6, 0);
         $.name = reader.string_(position, 8, null);
-        $.regions = reader.tableArray(position, 10, MNN.Region.decode);
-        $.quantInfo = reader.table(position, 12, MNN.TensorQuantInfo.decode);
+        $.regions = reader.tables(position, 10, MNN.Region);
+        $.quantInfo = reader.table(position, 12, MNN.TensorQuantInfo);
         return $;
     }
 };
@@ -1962,11 +1962,11 @@ MNN.SubGraphProto = class SubGraphProto {
     static decode(reader, position) {
         const $ = new MNN.SubGraphProto();
         $.name = reader.string_(position, 4, null);
-        $.inputs = reader.typedArray(position, 6, Int32Array);
-        $.outputs = reader.typedArray(position, 8, Int32Array);
+        $.inputs = reader.array(position, 6, Int32Array);
+        $.outputs = reader.array(position, 8, Int32Array);
         $.tensors = reader.strings_(position, 10);
-        $.nodes = reader.tableArray(position, 12, MNN.Op.decode);
-        $.extraTensorDescribe = reader.tableArray(position, 14, MNN.TensorDescribe.decode);
+        $.nodes = reader.tables(position, 12, MNN.Op);
+        $.extraTensorDescribe = reader.tables(position, 14, MNN.TensorDescribe);
         return $;
     }
 };
@@ -1993,16 +1993,16 @@ MNN.Net = class Net {
     static decode(reader, position) {
         const $ = new MNN.Net();
         $.bizCode = reader.string_(position, 4, null);
-        $.extraTensorDescribe = reader.tableArray(position, 6, MNN.TensorDescribe.decode);
-        $.extraInfo = reader.table(position, 8, MNN.ExtraInfo.decode);
-        $.oplists = reader.tableArray(position, 10, MNN.Op.decode);
+        $.extraTensorDescribe = reader.tables(position, 6, MNN.TensorDescribe);
+        $.extraInfo = reader.table(position, 8, MNN.ExtraInfo);
+        $.oplists = reader.tables(position, 10, MNN.Op);
         $.outputName = reader.strings_(position, 12);
         $.preferForwardType = reader.int8_(position, 14, 0);
         $.sourceType = reader.int8_(position, 16, 0);
         $.tensorName = reader.strings_(position, 18);
         $.tensorNumber = reader.int32_(position, 20, 0);
         $.usage = reader.int8_(position, 22, 0);
-        $.subgraphs = reader.tableArray(position, 24, MNN.SubGraphProto.decode);
+        $.subgraphs = reader.tables(position, 24, MNN.SubGraphProto);
         $.mnn_uuid = reader.string_(position, 26, null);
         return $;
     }

+ 63 - 63
source/mslite-schema.js

@@ -144,13 +144,13 @@ mindspore.schema.Vec2D = class Vec2D {
 
     static decode(reader, position) {
         const $ = new mindspore.schema.Vec2D();
-        $.data = reader.tableArray(position, 4, mindspore.schema.Vec.decode);
+        $.data = reader.tables(position, 4, mindspore.schema.Vec);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new mindspore.schema.Vec2D();
-        $.data = reader.objectArray(json.data, mindspore.schema.Vec.decodeText);
+        $.data = reader.objects(json.data, mindspore.schema.Vec);
         return $;
     }
 };
@@ -160,14 +160,14 @@ mindspore.schema.Attribute = class Attribute {
     static decode(reader, position) {
         const $ = new mindspore.schema.Attribute();
         $.name = reader.string_(position, 4, null);
-        $.data = reader.typedArray(position, 6, Uint8Array);
+        $.data = reader.array(position, 6, Uint8Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new mindspore.schema.Attribute();
         $.name = reader.value(json.name, null);
-        $.data = reader.typedArray(json.data, Uint8Array);
+        $.data = reader.array(json.data, Uint8Array);
         return $;
     }
 };
@@ -1000,14 +1000,14 @@ mindspore.schema.BatchToSpace = class BatchToSpace {
     static decode(reader, position) {
         const $ = new mindspore.schema.BatchToSpace();
         $.block_size = reader.int64s_(position, 4);
-        $.crops = reader.table(position, 6, mindspore.schema.Vec2D.decode);
+        $.crops = reader.table(position, 6, mindspore.schema.Vec2D);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new mindspore.schema.BatchToSpace();
         $.block_size = reader.array(json.block_size);
-        $.crops = reader.object(json.crops, mindspore.schema.Vec2D.decodeText);
+        $.crops = reader.object(json.crops, mindspore.schema.Vec2D);
         return $;
     }
 };
@@ -1017,14 +1017,14 @@ mindspore.schema.BatchToSpaceND = class BatchToSpaceND {
     static decode(reader, position) {
         const $ = new mindspore.schema.BatchToSpaceND();
         $.block_shape = reader.int64s_(position, 4);
-        $.crops = reader.table(position, 6, mindspore.schema.Vec2D.decode);
+        $.crops = reader.table(position, 6, mindspore.schema.Vec2D);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new mindspore.schema.BatchToSpaceND();
         $.block_shape = reader.array(json.block_shape);
-        $.crops = reader.object(json.crops, mindspore.schema.Vec2D.decodeText);
+        $.crops = reader.object(json.crops, mindspore.schema.Vec2D);
         return $;
     }
 };
@@ -1345,14 +1345,14 @@ mindspore.schema.ConstantOfShape = class ConstantOfShape {
     static decode(reader, position) {
         const $ = new mindspore.schema.ConstantOfShape();
         $.data_type = reader.int64_(position, 4, 0n);
-        $.value = reader.typedArray(position, 6, Float32Array);
+        $.value = reader.array(position, 6, Float32Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new mindspore.schema.ConstantOfShape();
         $.data_type = reader.int64(json.data_type, 0n);
-        $.value = reader.typedArray(json.value, Float32Array);
+        $.value = reader.array(json.value, Float32Array);
         return $;
     }
 };
@@ -1488,7 +1488,7 @@ mindspore.schema.DetectionPostProcess = class DetectionPostProcess {
         const $ = new mindspore.schema.DetectionPostProcess();
         $.format = reader.int32_(position, 4, 0);
         $.input_size = reader.int64_(position, 6, 0n);
-        $.scale = reader.typedArray(position, 8, Float32Array);
+        $.scale = reader.array(position, 8, Float32Array);
         $.nms_iou_threshold = reader.float32_(position, 10, 0);
         $.nms_score_threshold = reader.float32_(position, 12, 0);
         $.max_detections = reader.int64_(position, 14, 0n);
@@ -1504,7 +1504,7 @@ mindspore.schema.DetectionPostProcess = class DetectionPostProcess {
         const $ = new mindspore.schema.DetectionPostProcess();
         $.format = mindspore.schema.Format[json.format];
         $.input_size = reader.int64(json.input_size, 0n);
-        $.scale = reader.typedArray(json.scale, Float32Array);
+        $.scale = reader.array(json.scale, Float32Array);
         $.nms_iou_threshold = reader.value(json.nms_iou_threshold, 0);
         $.nms_score_threshold = reader.value(json.nms_score_threshold, 0);
         $.max_detections = reader.int64(json.max_detections, 0n);
@@ -2480,7 +2480,7 @@ mindspore.schema.PadFusion = class PadFusion {
 
     static decode(reader, position) {
         const $ = new mindspore.schema.PadFusion();
-        $.paddings = reader.table(position, 4, mindspore.schema.Vec2D.decode);
+        $.paddings = reader.table(position, 4, mindspore.schema.Vec2D);
         $.padding_mode = reader.int8_(position, 6, 0);
         $.constant_value = reader.float32_(position, 8, 0);
         return $;
@@ -2488,7 +2488,7 @@ mindspore.schema.PadFusion = class PadFusion {
 
     static decodeText(reader, json) {
         const $ = new mindspore.schema.PadFusion();
-        $.paddings = reader.object(json.paddings, mindspore.schema.Vec2D.decodeText);
+        $.paddings = reader.object(json.paddings, mindspore.schema.Vec2D);
         $.padding_mode = mindspore.schema.PaddingMode[json.padding_mode];
         $.constant_value = reader.value(json.constant_value, 0);
         return $;
@@ -2552,8 +2552,8 @@ mindspore.schema.PriorBox = class PriorBox {
         const $ = new mindspore.schema.PriorBox();
         $.min_sizes = reader.int64s_(position, 4);
         $.max_sizes = reader.int64s_(position, 6);
-        $.aspect_ratios = reader.typedArray(position, 8, Float32Array);
-        $.variances = reader.typedArray(position, 10, Float32Array);
+        $.aspect_ratios = reader.array(position, 8, Float32Array);
+        $.variances = reader.array(position, 10, Float32Array);
         $.image_size_w = reader.int64_(position, 12, 0n);
         $.image_size_h = reader.int64_(position, 14, 0n);
         $.step_w = reader.float32_(position, 16, 0);
@@ -2568,8 +2568,8 @@ mindspore.schema.PriorBox = class PriorBox {
         const $ = new mindspore.schema.PriorBox();
         $.min_sizes = reader.array(json.min_sizes);
         $.max_sizes = reader.array(json.max_sizes);
-        $.aspect_ratios = reader.typedArray(json.aspect_ratios, Float32Array);
-        $.variances = reader.typedArray(json.variances, Float32Array);
+        $.aspect_ratios = reader.array(json.aspect_ratios, Float32Array);
+        $.variances = reader.array(json.variances, Float32Array);
         $.image_size_w = reader.int64(json.image_size_w, 0n);
         $.image_size_h = reader.int64(json.image_size_h, 0n);
         $.step_w = reader.value(json.step_w, 0);
@@ -3032,14 +3032,14 @@ mindspore.schema.SpaceToBatch = class SpaceToBatch {
     static decode(reader, position) {
         const $ = new mindspore.schema.SpaceToBatch();
         $.block_size = reader.int64s_(position, 4);
-        $.paddings = reader.table(position, 6, mindspore.schema.Vec2D.decode);
+        $.paddings = reader.table(position, 6, mindspore.schema.Vec2D);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new mindspore.schema.SpaceToBatch();
         $.block_size = reader.array(json.block_size);
-        $.paddings = reader.object(json.paddings, mindspore.schema.Vec2D.decodeText);
+        $.paddings = reader.object(json.paddings, mindspore.schema.Vec2D);
         return $;
     }
 };
@@ -3049,14 +3049,14 @@ mindspore.schema.SpaceToBatchND = class SpaceToBatchND {
     static decode(reader, position) {
         const $ = new mindspore.schema.SpaceToBatchND();
         $.block_shape = reader.int64s_(position, 4);
-        $.paddings = reader.table(position, 6, mindspore.schema.Vec2D.decode);
+        $.paddings = reader.table(position, 6, mindspore.schema.Vec2D);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new mindspore.schema.SpaceToBatchND();
         $.block_shape = reader.array(json.block_shape);
-        $.paddings = reader.object(json.paddings, mindspore.schema.Vec2D.decodeText);
+        $.paddings = reader.object(json.paddings, mindspore.schema.Vec2D);
         return $;
     }
 };
@@ -3792,14 +3792,14 @@ mindspore.schema.Custom = class Custom {
     static decode(reader, position) {
         const $ = new mindspore.schema.Custom();
         $.type = reader.string_(position, 4, null);
-        $.attr = reader.tableArray(position, 6, mindspore.schema.Attribute.decode);
+        $.attr = reader.tables(position, 6, mindspore.schema.Attribute);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new mindspore.schema.Custom();
         $.type = reader.value(json.type, null);
-        $.attr = reader.objectArray(json.attr, mindspore.schema.Attribute.decodeText);
+        $.attr = reader.objects(json.attr, mindspore.schema.Attribute);
         return $;
     }
 };
@@ -3938,7 +3938,7 @@ mindspore.schema.TensorArray = class TensorArray {
         const $ = new mindspore.schema.TensorArray();
         $.dynamic_size = reader.bool_(position, 4, false);
         $.identical_element_shapes = reader.bool_(position, 6, false);
-        $.element_shape = reader.typedArray(position, 8, Int32Array);
+        $.element_shape = reader.array(position, 8, Int32Array);
         $.data_type = reader.int32_(position, 10, 0);
         return $;
     }
@@ -3947,7 +3947,7 @@ mindspore.schema.TensorArray = class TensorArray {
         const $ = new mindspore.schema.TensorArray();
         $.dynamic_size = reader.value(json.dynamic_size, false);
         $.identical_element_shapes = reader.value(json.identical_element_shapes, false);
-        $.element_shape = reader.typedArray(json.element_shape, Int32Array);
+        $.element_shape = reader.array(json.element_shape, Int32Array);
         $.data_type = reader.value(json.data_type, 0);
         return $;
     }
@@ -4442,17 +4442,17 @@ mindspore.schema.Tensor = class Tensor {
         const $ = new mindspore.schema.Tensor();
         $.nodeType = reader.int32_(position, 4, 0);
         $.dataType = reader.int32_(position, 6, 0);
-        $.dims = reader.typedArray(position, 8, Int32Array);
+        $.dims = reader.array(position, 8, Int32Array);
         $.format = reader.int32_(position, 10, 0);
         $.refCount = reader.int32_(position, 12, 0);
         $.offset = reader.int32_(position, 14, 0);
-        $.data = reader.typedArray(position, 16, Uint8Array);
-        $.quantParams = reader.tableArray(position, 18, mindspore.schema.QuantParam.decode);
-        $.quantClusters = reader.typedArray(position, 20, Float32Array);
+        $.data = reader.array(position, 16, Uint8Array);
+        $.quantParams = reader.tables(position, 18, mindspore.schema.QuantParam);
+        $.quantClusters = reader.array(position, 20, Float32Array);
         $.name = reader.string_(position, 22, null);
         $.enableHuffmanCode = reader.bool_(position, 24, false);
         $.weightQuantCompressType = reader.int32_(position, 26, 0);
-        $.externalData = reader.tableArray(position, 28, mindspore.schema.ExternalData.decode);
+        $.externalData = reader.tables(position, 28, mindspore.schema.ExternalData);
         return $;
     }
 
@@ -4460,17 +4460,17 @@ mindspore.schema.Tensor = class Tensor {
         const $ = new mindspore.schema.Tensor();
         $.nodeType = reader.value(json.nodeType, 0);
         $.dataType = reader.value(json.dataType, 0);
-        $.dims = reader.typedArray(json.dims, Int32Array);
+        $.dims = reader.array(json.dims, Int32Array);
         $.format = mindspore.schema.Format[json.format];
         $.refCount = reader.value(json.refCount, 0);
         $.offset = reader.value(json.offset, 0);
-        $.data = reader.typedArray(json.data, Uint8Array);
-        $.quantParams = reader.objectArray(json.quantParams, mindspore.schema.QuantParam.decodeText);
-        $.quantClusters = reader.typedArray(json.quantClusters, Float32Array);
+        $.data = reader.array(json.data, Uint8Array);
+        $.quantParams = reader.objects(json.quantParams, mindspore.schema.QuantParam);
+        $.quantClusters = reader.array(json.quantClusters, Float32Array);
         $.name = reader.value(json.name, null);
         $.enableHuffmanCode = reader.value(json.enableHuffmanCode, false);
         $.weightQuantCompressType = mindspore.schema.WeightQuantCompressType[json.weightQuantCompressType];
-        $.externalData = reader.objectArray(json.externalData, mindspore.schema.ExternalData.decodeText);
+        $.externalData = reader.objects(json.externalData, mindspore.schema.ExternalData);
         return $;
     }
 };
@@ -4489,7 +4489,7 @@ mindspore.schema.Primitive = class Primitive {
 
     static decode(reader, position) {
         const $ = new mindspore.schema.Primitive();
-        $.value = reader.union(position, 4, mindspore.schema.PrimitiveType.decode);
+        $.value = reader.union(position, 4, mindspore.schema.PrimitiveType);
         return $;
     }
 
@@ -4506,9 +4506,9 @@ mindspore.schema.CNode = class CNode {
         const $ = new mindspore.schema.CNode();
         $.name = reader.string_(position, 4, null);
         $.nodeType = reader.int32_(position, 6, 0);
-        $.primitive = reader.table(position, 8, mindspore.schema.Primitive.decode);
-        $.inputIndex = reader.typedArray(position, 10, Uint32Array);
-        $.outputIndex = reader.typedArray(position, 12, Uint32Array);
+        $.primitive = reader.table(position, 8, mindspore.schema.Primitive);
+        $.inputIndex = reader.array(position, 10, Uint32Array);
+        $.outputIndex = reader.array(position, 12, Uint32Array);
         $.quantType = reader.int32_(position, 14, 0);
         $.deviceType = reader.int32_(position, 16, -1);
         return $;
@@ -4518,9 +4518,9 @@ mindspore.schema.CNode = class CNode {
         const $ = new mindspore.schema.CNode();
         $.name = reader.value(json.name, null);
         $.nodeType = reader.value(json.nodeType, 0);
-        $.primitive = reader.object(json.primitive, mindspore.schema.Primitive.decodeText);
-        $.inputIndex = reader.typedArray(json.inputIndex, Uint32Array);
-        $.outputIndex = reader.typedArray(json.outputIndex, Uint32Array);
+        $.primitive = reader.object(json.primitive, mindspore.schema.Primitive);
+        $.inputIndex = reader.array(json.inputIndex, Uint32Array);
+        $.outputIndex = reader.array(json.outputIndex, Uint32Array);
         $.quantType = mindspore.schema.QuantType[json.quantType];
         $.deviceType = reader.value(json.deviceType, -1);
         return $;
@@ -4532,20 +4532,20 @@ mindspore.schema.SubGraph = class SubGraph {
     static decode(reader, position) {
         const $ = new mindspore.schema.SubGraph();
         $.name = reader.string_(position, 4, null);
-        $.inputIndices = reader.typedArray(position, 6, Uint32Array);
-        $.outputIndices = reader.typedArray(position, 8, Uint32Array);
-        $.nodeIndices = reader.typedArray(position, 10, Uint32Array);
-        $.tensorIndices = reader.typedArray(position, 12, Uint32Array);
+        $.inputIndices = reader.array(position, 6, Uint32Array);
+        $.outputIndices = reader.array(position, 8, Uint32Array);
+        $.nodeIndices = reader.array(position, 10, Uint32Array);
+        $.tensorIndices = reader.array(position, 12, Uint32Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new mindspore.schema.SubGraph();
         $.name = reader.value(json.name, null);
-        $.inputIndices = reader.typedArray(json.inputIndices, Uint32Array);
-        $.outputIndices = reader.typedArray(json.outputIndices, Uint32Array);
-        $.nodeIndices = reader.typedArray(json.nodeIndices, Uint32Array);
-        $.tensorIndices = reader.typedArray(json.tensorIndices, Uint32Array);
+        $.inputIndices = reader.array(json.inputIndices, Uint32Array);
+        $.outputIndices = reader.array(json.outputIndices, Uint32Array);
+        $.nodeIndices = reader.array(json.nodeIndices, Uint32Array);
+        $.tensorIndices = reader.array(json.tensorIndices, Uint32Array);
         return $;
     }
 };
@@ -4569,14 +4569,14 @@ mindspore.schema.MetaGraph = class MetaGraph {
         $.name = reader.string_(position, 4, null);
         $.version = reader.string_(position, 6, null);
         $.fmkType = reader.int32_(position, 8, 0);
-        $.inputIndex = reader.typedArray(position, 10, Uint32Array);
-        $.outputIndex = reader.typedArray(position, 12, Uint32Array);
+        $.inputIndex = reader.array(position, 10, Uint32Array);
+        $.outputIndex = reader.array(position, 12, Uint32Array);
         $.mempoolSize = reader.uint32_(position, 14, 0);
-        $.nodes = reader.tableArray(position, 16, mindspore.schema.CNode.decode);
-        $.allTensors = reader.tableArray(position, 18, mindspore.schema.Tensor.decode);
-        $.subGraph = reader.tableArray(position, 20, mindspore.schema.SubGraph.decode);
+        $.nodes = reader.tables(position, 16, mindspore.schema.CNode);
+        $.allTensors = reader.tables(position, 18, mindspore.schema.Tensor);
+        $.subGraph = reader.tables(position, 20, mindspore.schema.SubGraph);
         $.obfuscate = reader.bool_(position, 22, false);
-        $.obfMetaData = reader.typedArray(position, 24, Uint8Array);
+        $.obfMetaData = reader.array(position, 24, Uint8Array);
         return $;
     }
 
@@ -4585,14 +4585,14 @@ mindspore.schema.MetaGraph = class MetaGraph {
         $.name = reader.value(json.name, null);
         $.version = reader.value(json.version, null);
         $.fmkType = reader.value(json.fmkType, 0);
-        $.inputIndex = reader.typedArray(json.inputIndex, Uint32Array);
-        $.outputIndex = reader.typedArray(json.outputIndex, Uint32Array);
+        $.inputIndex = reader.array(json.inputIndex, Uint32Array);
+        $.outputIndex = reader.array(json.outputIndex, Uint32Array);
         $.mempoolSize = reader.value(json.mempoolSize, 0);
-        $.nodes = reader.objectArray(json.nodes, mindspore.schema.CNode.decodeText);
-        $.allTensors = reader.objectArray(json.allTensors, mindspore.schema.Tensor.decodeText);
-        $.subGraph = reader.objectArray(json.subGraph, mindspore.schema.SubGraph.decodeText);
+        $.nodes = reader.objects(json.nodes, mindspore.schema.CNode);
+        $.allTensors = reader.objects(json.allTensors, mindspore.schema.Tensor);
+        $.subGraph = reader.objects(json.subGraph, mindspore.schema.SubGraph);
         $.obfuscate = reader.value(json.obfuscate, false);
-        $.obfMetaData = reader.typedArray(json.obfMetaData, Uint8Array);
+        $.obfMetaData = reader.array(json.obfMetaData, Uint8Array);
         return $;
     }
 };

+ 43 - 43
source/onnx-schema.js

@@ -23,7 +23,7 @@ onnxruntime.fbs.Shape = class Shape {
 
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.Shape();
-        $.dim = reader.tableArray(position, 4, onnxruntime.fbs.Dimension.decode);
+        $.dim = reader.tables(position, 4, onnxruntime.fbs.Dimension);
         return $;
     }
 };
@@ -32,7 +32,7 @@ onnxruntime.fbs.Dimension = class Dimension {
 
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.Dimension();
-        $.value = reader.table(position, 4, onnxruntime.fbs.DimensionValue.decode);
+        $.value = reader.table(position, 4, onnxruntime.fbs.DimensionValue);
         $.denotation = reader.string_(position, 6, null);
         return $;
     }
@@ -84,7 +84,7 @@ onnxruntime.fbs.TensorTypeAndShape = class TensorTypeAndShape {
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.TensorTypeAndShape();
         $.elem_type = reader.int32_(position, 4, 0);
-        $.shape = reader.table(position, 6, onnxruntime.fbs.Shape.decode);
+        $.shape = reader.table(position, 6, onnxruntime.fbs.Shape);
         return $;
     }
 };
@@ -94,7 +94,7 @@ onnxruntime.fbs.MapType = class MapType {
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.MapType();
         $.key_type = reader.int32_(position, 4, 0);
-        $.value_type = reader.table(position, 6, onnxruntime.fbs.TypeInfo.decode);
+        $.value_type = reader.table(position, 6, onnxruntime.fbs.TypeInfo);
         return $;
     }
 };
@@ -103,7 +103,7 @@ onnxruntime.fbs.SequenceType = class SequenceType {
 
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.SequenceType();
-        $.elem_type = reader.table(position, 4, onnxruntime.fbs.TypeInfo.decode);
+        $.elem_type = reader.table(position, 4, onnxruntime.fbs.TypeInfo);
         return $;
     }
 };
@@ -129,8 +129,8 @@ onnxruntime.fbs.NodeEdge = class NodeEdge {
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.NodeEdge();
         $.node_index = reader.uint32_(position, 4, 0);
-        $.input_edges = reader.structArray(position, 6, onnxruntime.fbs.EdgeEnd.decode);
-        $.output_edges = reader.structArray(position, 8, onnxruntime.fbs.EdgeEnd.decode);
+        $.input_edges = reader.structs(position, 6, onnxruntime.fbs.EdgeEnd);
+        $.output_edges = reader.structs(position, 8, onnxruntime.fbs.EdgeEnd);
         return $;
     }
 };
@@ -149,8 +149,8 @@ onnxruntime.fbs.Node = class Node {
         $.execution_provider_type = reader.string_(position, 18, null);
         $.inputs = reader.strings_(position, 20);
         $.outputs = reader.strings_(position, 22);
-        $.attributes = reader.tableArray(position, 24, onnxruntime.fbs.Attribute.decode);
-        $.input_arg_counts = reader.typedArray(position, 26, Int32Array);
+        $.attributes = reader.tables(position, 24, onnxruntime.fbs.Attribute);
+        $.input_arg_counts = reader.array(position, 26, Int32Array);
         $.implicit_inputs = reader.strings_(position, 28);
         return $;
     }
@@ -162,7 +162,7 @@ onnxruntime.fbs.ValueInfo = class ValueInfo {
         const $ = new onnxruntime.fbs.ValueInfo();
         $.name = reader.string_(position, 4, null);
         $.doc_string = reader.string_(position, 6, null);
-        $.type = reader.table(position, 8, onnxruntime.fbs.TypeInfo.decode);
+        $.type = reader.table(position, 8, onnxruntime.fbs.TypeInfo);
         return $;
     }
 };
@@ -184,7 +184,7 @@ onnxruntime.fbs.TypeInfo = class TypeInfo {
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.TypeInfo();
         $.denotation = reader.string_(position, 4, null);
-        $.value = reader.union(position, 6, onnxruntime.fbs.TypeInfoValue.decode);
+        $.value = reader.union(position, 6, onnxruntime.fbs.TypeInfoValue);
         return $;
     }
 };
@@ -207,7 +207,7 @@ onnxruntime.fbs.Tensor = class Tensor {
         $.doc_string = reader.string_(position, 6, null);
         $.dims = reader.int64s_(position, 8);
         $.data_type = reader.int32_(position, 10, 0);
-        $.raw_data = reader.typedArray(position, 12, Uint8Array);
+        $.raw_data = reader.array(position, 12, Uint8Array);
         $.string_data = reader.strings_(position, 14);
         return $;
     }
@@ -217,8 +217,8 @@ onnxruntime.fbs.SparseTensor = class SparseTensor {
 
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.SparseTensor();
-        $.values = reader.table(position, 4, onnxruntime.fbs.Tensor.decode);
-        $.indices = reader.table(position, 6, onnxruntime.fbs.Tensor.decode);
+        $.values = reader.table(position, 4, onnxruntime.fbs.Tensor);
+        $.indices = reader.table(position, 6, onnxruntime.fbs.Tensor);
         $.dims = reader.int64s_(position, 8);
         return $;
     }
@@ -234,13 +234,13 @@ onnxruntime.fbs.Attribute = class Attribute {
         $.f = reader.float32_(position, 10, 0);
         $.i = reader.int64_(position, 12, 0n);
         $.s = reader.string_(position, 14, null);
-        $.t = reader.table(position, 16, onnxruntime.fbs.Tensor.decode);
-        $.g = reader.table(position, 18, onnxruntime.fbs.Graph.decode);
-        $.floats = reader.typedArray(position, 20, Float32Array);
+        $.t = reader.table(position, 16, onnxruntime.fbs.Tensor);
+        $.g = reader.table(position, 18, onnxruntime.fbs.Graph);
+        $.floats = reader.array(position, 20, Float32Array);
         $.ints = reader.int64s_(position, 22);
         $.strings = reader.strings_(position, 24);
-        $.tensors = reader.tableArray(position, 26, onnxruntime.fbs.Tensor.decode);
-        $.graphs = reader.tableArray(position, 28, onnxruntime.fbs.Graph.decode);
+        $.tensors = reader.tables(position, 26, onnxruntime.fbs.Tensor);
+        $.graphs = reader.tables(position, 28, onnxruntime.fbs.Graph);
         return $;
     }
 };
@@ -249,7 +249,7 @@ onnxruntime.fbs.NodesToOptimizeIndices = class NodesToOptimizeIndices {
 
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.NodesToOptimizeIndices();
-        $.node_indices = reader.typedArray(position, 4, Uint32Array);
+        $.node_indices = reader.array(position, 4, Uint32Array);
         $.num_inputs = reader.uint32_(position, 6, 0);
         $.num_outputs = reader.uint32_(position, 8, 0);
         $.has_variadic_input = reader.bool_(position, 10, false);
@@ -275,8 +275,8 @@ onnxruntime.fbs.RuntimeOptimizationRecord = class RuntimeOptimizationRecord {
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.RuntimeOptimizationRecord();
         $.action_id = reader.string_(position, 4, null);
-        $.nodes_to_optimize_indices = reader.table(position, 6, onnxruntime.fbs.NodesToOptimizeIndices.decode);
-        $.produced_nodes = reader.tableArray(position, 8, onnxruntime.fbs.DeprecatedNodeIndexAndKernelDefHash.decode);
+        $.nodes_to_optimize_indices = reader.table(position, 6, onnxruntime.fbs.NodesToOptimizeIndices);
+        $.produced_nodes = reader.tables(position, 8, onnxruntime.fbs.DeprecatedNodeIndexAndKernelDefHash);
         $.produced_op_ids = reader.strings_(position, 10);
         return $;
     }
@@ -287,7 +287,7 @@ onnxruntime.fbs.RuntimeOptimizationRecordContainerEntry = class RuntimeOptimizat
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.RuntimeOptimizationRecordContainerEntry();
         $.optimizer_name = reader.string_(position, 4, null);
-        $.runtime_optimization_records = reader.tableArray(position, 6, onnxruntime.fbs.RuntimeOptimizationRecord.decode);
+        $.runtime_optimization_records = reader.tables(position, 6, onnxruntime.fbs.RuntimeOptimizationRecord);
         return $;
     }
 };
@@ -296,7 +296,7 @@ onnxruntime.fbs.RuntimeOptimizations = class RuntimeOptimizations {
 
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.RuntimeOptimizations();
-        $.records = reader.tableArray(position, 4, onnxruntime.fbs.RuntimeOptimizationRecordContainerEntry.decode);
+        $.records = reader.tables(position, 4, onnxruntime.fbs.RuntimeOptimizationRecordContainerEntry);
         return $;
     }
 };
@@ -305,15 +305,15 @@ onnxruntime.fbs.Graph = class Graph {
 
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.Graph();
-        $.initializers = reader.tableArray(position, 4, onnxruntime.fbs.Tensor.decode);
-        $.node_args = reader.tableArray(position, 6, onnxruntime.fbs.ValueInfo.decode);
-        $.nodes = reader.tableArray(position, 8, onnxruntime.fbs.Node.decode);
+        $.initializers = reader.tables(position, 4, onnxruntime.fbs.Tensor);
+        $.node_args = reader.tables(position, 6, onnxruntime.fbs.ValueInfo);
+        $.nodes = reader.tables(position, 8, onnxruntime.fbs.Node);
         $.max_node_index = reader.uint32_(position, 10, 0);
-        $.node_edges = reader.tableArray(position, 12, onnxruntime.fbs.NodeEdge.decode);
+        $.node_edges = reader.tables(position, 12, onnxruntime.fbs.NodeEdge);
         $.inputs = reader.strings_(position, 14);
         $.outputs = reader.strings_(position, 16);
-        $.sparse_initializers = reader.tableArray(position, 18, onnxruntime.fbs.SparseTensor.decode);
-        $.runtime_optimizations = reader.table(position, 20, onnxruntime.fbs.RuntimeOptimizations.decode);
+        $.sparse_initializers = reader.tables(position, 18, onnxruntime.fbs.SparseTensor);
+        $.runtime_optimizations = reader.table(position, 20, onnxruntime.fbs.RuntimeOptimizations);
         return $;
     }
 };
@@ -333,15 +333,15 @@ onnxruntime.fbs.Model = class Model {
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.Model();
         $.ir_version = reader.int64_(position, 4, 0n);
-        $.opset_import = reader.tableArray(position, 6, onnxruntime.fbs.OperatorSetId.decode);
+        $.opset_import = reader.tables(position, 6, onnxruntime.fbs.OperatorSetId);
         $.producer_name = reader.string_(position, 8, null);
         $.producer_version = reader.string_(position, 10, null);
         $.domain = reader.string_(position, 12, null);
         $.model_version = reader.int64_(position, 14, 0n);
         $.doc_string = reader.string_(position, 16, null);
-        $.graph = reader.table(position, 18, onnxruntime.fbs.Graph.decode);
+        $.graph = reader.table(position, 18, onnxruntime.fbs.Graph);
         $.graph_doc_string = reader.string_(position, 20, null);
-        $.metadata_props = reader.tableArray(position, 22, onnxruntime.fbs.StringStringEntry.decode);
+        $.metadata_props = reader.tables(position, 22, onnxruntime.fbs.StringStringEntry);
         return $;
     }
 };
@@ -350,7 +350,7 @@ onnxruntime.fbs.DeprecatedKernelCreateInfos = class DeprecatedKernelCreateInfos
 
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.DeprecatedKernelCreateInfos();
-        $.node_indices = reader.typedArray(position, 4, Uint32Array);
+        $.node_indices = reader.array(position, 4, Uint32Array);
         $.kernel_def_hashes = reader.uint64s_(position, 6);
         return $;
     }
@@ -361,7 +361,7 @@ onnxruntime.fbs.DeprecatedSubGraphSessionState = class DeprecatedSubGraphSession
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.DeprecatedSubGraphSessionState();
         $.graph_id = reader.string_(position, 4, null);
-        $.session_state = reader.table(position, 6, onnxruntime.fbs.DeprecatedSessionState.decode);
+        $.session_state = reader.table(position, 6, onnxruntime.fbs.DeprecatedSessionState);
         return $;
     }
 };
@@ -370,8 +370,8 @@ onnxruntime.fbs.DeprecatedSessionState = class DeprecatedSessionState {
 
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.DeprecatedSessionState();
-        $.kernels = reader.table(position, 4, onnxruntime.fbs.DeprecatedKernelCreateInfos.decode);
-        $.sub_graph_session_states = reader.tableArray(position, 6, onnxruntime.fbs.DeprecatedSubGraphSessionState.decode);
+        $.kernels = reader.table(position, 4, onnxruntime.fbs.DeprecatedKernelCreateInfos);
+        $.sub_graph_session_states = reader.tables(position, 6, onnxruntime.fbs.DeprecatedSubGraphSessionState);
         return $;
     }
 };
@@ -396,7 +396,7 @@ onnxruntime.fbs.KernelTypeStrArgsEntry = class KernelTypeStrArgsEntry {
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.KernelTypeStrArgsEntry();
         $.kernel_type_str = reader.string_(position, 4, null);
-        $.args = reader.tableArray(position, 6, onnxruntime.fbs.ArgTypeAndIndex.decode);
+        $.args = reader.tables(position, 6, onnxruntime.fbs.ArgTypeAndIndex);
         return $;
     }
 };
@@ -406,7 +406,7 @@ onnxruntime.fbs.OpIdKernelTypeStrArgsEntry = class OpIdKernelTypeStrArgsEntry {
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.OpIdKernelTypeStrArgsEntry();
         $.op_id = reader.string_(position, 4, null);
-        $.kernel_type_str_args = reader.tableArray(position, 6, onnxruntime.fbs.KernelTypeStrArgsEntry.decode);
+        $.kernel_type_str_args = reader.tables(position, 6, onnxruntime.fbs.KernelTypeStrArgsEntry);
         return $;
     }
 };
@@ -415,7 +415,7 @@ onnxruntime.fbs.KernelTypeStrResolver = class KernelTypeStrResolver {
 
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.KernelTypeStrResolver();
-        $.op_kernel_type_str_args = reader.tableArray(position, 4, onnxruntime.fbs.OpIdKernelTypeStrArgsEntry.decode);
+        $.op_kernel_type_str_args = reader.tables(position, 4, onnxruntime.fbs.OpIdKernelTypeStrArgsEntry);
         return $;
     }
 };
@@ -433,9 +433,9 @@ onnxruntime.fbs.InferenceSession = class InferenceSession {
     static decode(reader, position) {
         const $ = new onnxruntime.fbs.InferenceSession();
         $.ort_version = reader.string_(position, 4, null);
-        $.model = reader.table(position, 6, onnxruntime.fbs.Model.decode);
-        $.session_state = reader.table(position, 8, onnxruntime.fbs.DeprecatedSessionState.decode);
-        $.kernel_type_str_resolver = reader.table(position, 10, onnxruntime.fbs.KernelTypeStrResolver.decode);
+        $.model = reader.table(position, 6, onnxruntime.fbs.Model);
+        $.session_state = reader.table(position, 8, onnxruntime.fbs.DeprecatedSessionState);
+        $.kernel_type_str_resolver = reader.table(position, 10, onnxruntime.fbs.KernelTypeStrResolver);
         return $;
     }
 };

+ 55 - 55
source/paddle-schema.js

@@ -46,9 +46,9 @@ paddle.lite.fbs.proto.OpDesc = class OpDesc {
     static decode(reader, position) {
         const $ = new paddle.lite.fbs.proto.OpDesc();
         $.type = reader.string_(position, 4, null);
-        $.inputs = reader.tableArray(position, 6, paddle.lite.fbs.proto.OpDesc_.Var.decode);
-        $.outputs = reader.tableArray(position, 8, paddle.lite.fbs.proto.OpDesc_.Var.decode);
-        $.attrs = reader.tableArray(position, 10, paddle.lite.fbs.proto.OpDesc_.Attr.decode);
+        $.inputs = reader.tables(position, 6, paddle.lite.fbs.proto.OpDesc_.Var);
+        $.outputs = reader.tables(position, 8, paddle.lite.fbs.proto.OpDesc_.Var);
+        $.attrs = reader.tables(position, 10, paddle.lite.fbs.proto.OpDesc_.Attr);
         $.is_target = reader.bool_(position, 12, false);
         return $;
     }
@@ -56,9 +56,9 @@ paddle.lite.fbs.proto.OpDesc = class OpDesc {
     static decodeText(reader, json) {
         const $ = new paddle.lite.fbs.proto.OpDesc();
         $.type = reader.value(json.type, null);
-        $.inputs = reader.objectArray(json.inputs, paddle.lite.fbs.proto.OpDesc_.Var.decodeText);
-        $.outputs = reader.objectArray(json.outputs, paddle.lite.fbs.proto.OpDesc_.Var.decodeText);
-        $.attrs = reader.objectArray(json.attrs, paddle.lite.fbs.proto.OpDesc_.Attr.decodeText);
+        $.inputs = reader.objects(json.inputs, paddle.lite.fbs.proto.OpDesc_.Var);
+        $.outputs = reader.objects(json.outputs, paddle.lite.fbs.proto.OpDesc_.Var);
+        $.attrs = reader.objects(json.attrs, paddle.lite.fbs.proto.OpDesc_.Attr);
         $.is_target = reader.value(json.is_target, false);
         return $;
     }
@@ -69,22 +69,22 @@ paddle.lite.fbs.proto.VarType = class VarType {
     static decode(reader, position) {
         const $ = new paddle.lite.fbs.proto.VarType();
         $.type = reader.int32_(position, 4, 0);
-        $.selected_rows = reader.table(position, 6, paddle.lite.fbs.proto.VarType_.TensorDesc.decode);
-        $.lod_tensor = reader.table(position, 8, paddle.lite.fbs.proto.VarType_.LoDTensorDesc.decode);
-        $.tensor_array = reader.table(position, 10, paddle.lite.fbs.proto.VarType_.LoDTensorArrayDesc.decode);
-        $.reader = reader.table(position, 12, paddle.lite.fbs.proto.VarType_.ReaderDesc.decode);
-        $.tuple = reader.table(position, 14, paddle.lite.fbs.proto.VarType_.Tuple.decode);
+        $.selected_rows = reader.table(position, 6, paddle.lite.fbs.proto.VarType_.TensorDesc);
+        $.lod_tensor = reader.table(position, 8, paddle.lite.fbs.proto.VarType_.LoDTensorDesc);
+        $.tensor_array = reader.table(position, 10, paddle.lite.fbs.proto.VarType_.LoDTensorArrayDesc);
+        $.reader = reader.table(position, 12, paddle.lite.fbs.proto.VarType_.ReaderDesc);
+        $.tuple = reader.table(position, 14, paddle.lite.fbs.proto.VarType_.Tuple);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new paddle.lite.fbs.proto.VarType();
         $.type = paddle.lite.fbs.proto.VarType_.Type[json.type];
-        $.selected_rows = reader.object(json.selected_rows, paddle.lite.fbs.proto.VarType_.TensorDesc.decodeText);
-        $.lod_tensor = reader.object(json.lod_tensor, paddle.lite.fbs.proto.VarType_.LoDTensorDesc.decodeText);
-        $.tensor_array = reader.object(json.tensor_array, paddle.lite.fbs.proto.VarType_.LoDTensorArrayDesc.decodeText);
-        $.reader = reader.object(json.reader, paddle.lite.fbs.proto.VarType_.ReaderDesc.decodeText);
-        $.tuple = reader.object(json.tuple, paddle.lite.fbs.proto.VarType_.Tuple.decodeText);
+        $.selected_rows = reader.object(json.selected_rows, paddle.lite.fbs.proto.VarType_.TensorDesc);
+        $.lod_tensor = reader.object(json.lod_tensor, paddle.lite.fbs.proto.VarType_.LoDTensorDesc);
+        $.tensor_array = reader.object(json.tensor_array, paddle.lite.fbs.proto.VarType_.LoDTensorArrayDesc);
+        $.reader = reader.object(json.reader, paddle.lite.fbs.proto.VarType_.ReaderDesc);
+        $.tuple = reader.object(json.tuple, paddle.lite.fbs.proto.VarType_.Tuple);
         return $;
     }
 };
@@ -94,7 +94,7 @@ paddle.lite.fbs.proto.VarDesc = class VarDesc {
     static decode(reader, position) {
         const $ = new paddle.lite.fbs.proto.VarDesc();
         $.name = reader.string_(position, 4, null);
-        $.type = reader.table(position, 6, paddle.lite.fbs.proto.VarType.decode);
+        $.type = reader.table(position, 6, paddle.lite.fbs.proto.VarType);
         $.persistable = reader.bool_(position, 8, false);
         $.need_check_feed = reader.bool_(position, 10, false);
         return $;
@@ -103,7 +103,7 @@ paddle.lite.fbs.proto.VarDesc = class VarDesc {
     static decodeText(reader, json) {
         const $ = new paddle.lite.fbs.proto.VarDesc();
         $.name = reader.value(json.name, null);
-        $.type = reader.object(json.type, paddle.lite.fbs.proto.VarType.decodeText);
+        $.type = reader.object(json.type, paddle.lite.fbs.proto.VarType);
         $.persistable = reader.value(json.persistable, false);
         $.need_check_feed = reader.value(json.need_check_feed, false);
         return $;
@@ -116,8 +116,8 @@ paddle.lite.fbs.proto.BlockDesc = class BlockDesc {
         const $ = new paddle.lite.fbs.proto.BlockDesc();
         $.idx = reader.int32_(position, 4, 0);
         $.parent_idx = reader.int32_(position, 6, 0);
-        $.vars = reader.tableArray(position, 8, paddle.lite.fbs.proto.VarDesc.decode);
-        $.ops = reader.tableArray(position, 10, paddle.lite.fbs.proto.OpDesc.decode);
+        $.vars = reader.tables(position, 8, paddle.lite.fbs.proto.VarDesc);
+        $.ops = reader.tables(position, 10, paddle.lite.fbs.proto.OpDesc);
         $.forward_block_idx = reader.int32_(position, 12, -1);
         return $;
     }
@@ -126,8 +126,8 @@ paddle.lite.fbs.proto.BlockDesc = class BlockDesc {
         const $ = new paddle.lite.fbs.proto.BlockDesc();
         $.idx = reader.value(json.idx, 0);
         $.parent_idx = reader.value(json.parent_idx, 0);
-        $.vars = reader.objectArray(json.vars, paddle.lite.fbs.proto.VarDesc.decodeText);
-        $.ops = reader.objectArray(json.ops, paddle.lite.fbs.proto.OpDesc.decodeText);
+        $.vars = reader.objects(json.vars, paddle.lite.fbs.proto.VarDesc);
+        $.ops = reader.objects(json.ops, paddle.lite.fbs.proto.OpDesc);
         $.forward_block_idx = reader.value(json.forward_block_idx, -1);
         return $;
     }
@@ -152,13 +152,13 @@ paddle.lite.fbs.proto.OpVersionMap = class OpVersionMap {
 
     static decode(reader, position) {
         const $ = new paddle.lite.fbs.proto.OpVersionMap();
-        $.pair = reader.tableArray(position, 4, paddle.lite.fbs.proto.OpVersionMap_.OpVersionPair.decode);
+        $.pair = reader.tables(position, 4, paddle.lite.fbs.proto.OpVersionMap_.OpVersionPair);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new paddle.lite.fbs.proto.OpVersionMap();
-        $.pair = reader.objectArray(json.pair, paddle.lite.fbs.proto.OpVersionMap_.OpVersionPair.decodeText);
+        $.pair = reader.objects(json.pair, paddle.lite.fbs.proto.OpVersionMap_.OpVersionPair);
         return $;
     }
 };
@@ -175,17 +175,17 @@ paddle.lite.fbs.proto.ProgramDesc = class ProgramDesc {
 
     static decode(reader, position) {
         const $ = new paddle.lite.fbs.proto.ProgramDesc();
-        $.blocks = reader.tableArray(position, 4, paddle.lite.fbs.proto.BlockDesc.decode);
-        $.version = reader.table(position, 6, paddle.lite.fbs.proto.Version.decode);
-        $.op_version_map = reader.table(position, 8, paddle.lite.fbs.proto.OpVersionMap.decode);
+        $.blocks = reader.tables(position, 4, paddle.lite.fbs.proto.BlockDesc);
+        $.version = reader.table(position, 6, paddle.lite.fbs.proto.Version);
+        $.op_version_map = reader.table(position, 8, paddle.lite.fbs.proto.OpVersionMap);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new paddle.lite.fbs.proto.ProgramDesc();
-        $.blocks = reader.objectArray(json.blocks, paddle.lite.fbs.proto.BlockDesc.decodeText);
-        $.version = reader.object(json.version, paddle.lite.fbs.proto.Version.decodeText);
-        $.op_version_map = reader.object(json.op_version_map, paddle.lite.fbs.proto.OpVersionMap.decodeText);
+        $.blocks = reader.objects(json.blocks, paddle.lite.fbs.proto.BlockDesc);
+        $.version = reader.object(json.version, paddle.lite.fbs.proto.Version);
+        $.op_version_map = reader.object(json.op_version_map, paddle.lite.fbs.proto.OpVersionMap);
         return $;
     }
 };
@@ -194,13 +194,13 @@ paddle.lite.fbs.proto.CombinedParamsDesc = class CombinedParamsDesc {
 
     static decode(reader, position) {
         const $ = new paddle.lite.fbs.proto.CombinedParamsDesc();
-        $.params = reader.tableArray(position, 4, paddle.lite.fbs.proto.ParamDesc.decode);
+        $.params = reader.tables(position, 4, paddle.lite.fbs.proto.ParamDesc);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new paddle.lite.fbs.proto.CombinedParamsDesc();
-        $.params = reader.objectArray(json.params, paddle.lite.fbs.proto.ParamDesc.decodeText);
+        $.params = reader.objects(json.params, paddle.lite.fbs.proto.ParamDesc);
         return $;
     }
 };
@@ -217,15 +217,15 @@ paddle.lite.fbs.proto.ParamDesc = class ParamDesc {
 
     static decode(reader, position) {
         const $ = new paddle.lite.fbs.proto.ParamDesc();
-        $.version = reader.table(position, 4, paddle.lite.fbs.proto.ParamDesc_.VersionDesc.decode);
+        $.version = reader.table(position, 4, paddle.lite.fbs.proto.ParamDesc_.VersionDesc);
         $.name = reader.string_(position, 6, null);
-        $.variable = reader.union(position, 8, paddle.lite.fbs.proto.ParamDesc_.VariableDesc.decode);
+        $.variable = reader.union(position, 8, paddle.lite.fbs.proto.ParamDesc_.VariableDesc);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new paddle.lite.fbs.proto.ParamDesc();
-        $.version = reader.object(json.version, paddle.lite.fbs.proto.ParamDesc_.VersionDesc.decodeText);
+        $.version = reader.object(json.version, paddle.lite.fbs.proto.ParamDesc_.VersionDesc);
         $.name = reader.value(json.name, null);
         $.variable = paddle.lite.fbs.proto.ParamDesc_.VariableDesc.decodeText(reader, json.variable, json.variable_type);
         return $;
@@ -285,14 +285,14 @@ paddle.lite.fbs.proto.VarType_.LoDTensorDesc = class LoDTensorDesc {
 
     static decode(reader, position) {
         const $ = new paddle.lite.fbs.proto.VarType_.LoDTensorDesc();
-        $.tensor = reader.table(position, 4, paddle.lite.fbs.proto.VarType_.TensorDesc.decode);
+        $.tensor = reader.table(position, 4, paddle.lite.fbs.proto.VarType_.TensorDesc);
         $.lod_level = reader.int32_(position, 6, 0);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new paddle.lite.fbs.proto.VarType_.LoDTensorDesc();
-        $.tensor = reader.object(json.tensor, paddle.lite.fbs.proto.VarType_.TensorDesc.decodeText);
+        $.tensor = reader.object(json.tensor, paddle.lite.fbs.proto.VarType_.TensorDesc);
         $.lod_level = reader.value(json.lod_level, 0);
         return $;
     }
@@ -302,14 +302,14 @@ paddle.lite.fbs.proto.VarType_.LoDTensorArrayDesc = class LoDTensorArrayDesc {
 
     static decode(reader, position) {
         const $ = new paddle.lite.fbs.proto.VarType_.LoDTensorArrayDesc();
-        $.tensor = reader.table(position, 4, paddle.lite.fbs.proto.VarType_.TensorDesc.decode);
+        $.tensor = reader.table(position, 4, paddle.lite.fbs.proto.VarType_.TensorDesc);
         $.lod_level = reader.int32_(position, 6, 0);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new paddle.lite.fbs.proto.VarType_.LoDTensorArrayDesc();
-        $.tensor = reader.object(json.tensor, paddle.lite.fbs.proto.VarType_.TensorDesc.decodeText);
+        $.tensor = reader.object(json.tensor, paddle.lite.fbs.proto.VarType_.TensorDesc);
         $.lod_level = reader.value(json.lod_level, 0);
         return $;
     }
@@ -319,13 +319,13 @@ paddle.lite.fbs.proto.VarType_.ReaderDesc = class ReaderDesc {
 
     static decode(reader, position) {
         const $ = new paddle.lite.fbs.proto.VarType_.ReaderDesc();
-        $.lod_tensor = reader.tableArray(position, 4, paddle.lite.fbs.proto.VarType_.LoDTensorDesc.decode);
+        $.lod_tensor = reader.tables(position, 4, paddle.lite.fbs.proto.VarType_.LoDTensorDesc);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new paddle.lite.fbs.proto.VarType_.ReaderDesc();
-        $.lod_tensor = reader.objectArray(json.lod_tensor, paddle.lite.fbs.proto.VarType_.LoDTensorDesc.decodeText);
+        $.lod_tensor = reader.objects(json.lod_tensor, paddle.lite.fbs.proto.VarType_.LoDTensorDesc);
         return $;
     }
 };
@@ -334,13 +334,13 @@ paddle.lite.fbs.proto.VarType_.Tuple = class Tuple {
 
     static decode(reader, position) {
         const $ = new paddle.lite.fbs.proto.VarType_.Tuple();
-        $.element_type = reader.typedArray(position, 4, Int32Array);
+        $.element_type = reader.array(position, 4, Int32Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new paddle.lite.fbs.proto.VarType_.Tuple();
-        $.element_type = reader.objectArray(json.element_type, paddle.lite.fbs.proto.VarType_.Type.decodeText);
+        $.element_type = reader.objects(json.element_type, paddle.lite.fbs.proto.VarType_.Type);
         return $;
     }
 };
@@ -378,17 +378,17 @@ paddle.lite.fbs.proto.OpDesc_.Attr = class Attr {
         $.i = reader.int32_(position, 8, 0);
         $.f = reader.float32_(position, 10, 0);
         $.s = reader.string_(position, 12, null);
-        $.ints = reader.typedArray(position, 14, Int32Array);
-        $.floats = reader.typedArray(position, 16, Float32Array);
+        $.ints = reader.array(position, 14, Int32Array);
+        $.floats = reader.array(position, 16, Float32Array);
         $.strings = reader.strings_(position, 18);
         $.b = reader.bool_(position, 20, false);
         $.bools = reader.bools_(position, 22);
         $.block_idx = reader.int32_(position, 24, 0);
         $.l = reader.int64_(position, 26, 0n);
-        $.blocks_idx = reader.typedArray(position, 28, Int32Array);
+        $.blocks_idx = reader.array(position, 28, Int32Array);
         $.longs = reader.int64s_(position, 30);
         $.float64 = reader.float64_(position, 32, 0);
-        $.float64s = reader.typedArray(position, 34, Float64Array);
+        $.float64s = reader.array(position, 34, Float64Array);
         return $;
     }
 
@@ -399,17 +399,17 @@ paddle.lite.fbs.proto.OpDesc_.Attr = class Attr {
         $.i = reader.value(json.i, 0);
         $.f = reader.value(json.f, 0);
         $.s = reader.value(json.s, null);
-        $.ints = reader.typedArray(json.ints, Int32Array);
-        $.floats = reader.typedArray(json.floats, Float32Array);
+        $.ints = reader.array(json.ints, Int32Array);
+        $.floats = reader.array(json.floats, Float32Array);
         $.strings = reader.array(json.strings);
         $.b = reader.value(json.b, false);
         $.bools = reader.array(json.bools);
         $.block_idx = reader.value(json.block_idx, 0);
         $.l = reader.int64(json.l, 0n);
-        $.blocks_idx = reader.typedArray(json.blocks_idx, Int32Array);
+        $.blocks_idx = reader.array(json.blocks_idx, Int32Array);
         $.longs = reader.array(json.longs);
         $.float64 = reader.value(json.float64, 0);
-        $.float64s = reader.typedArray(json.float64s, Float64Array);
+        $.float64s = reader.array(json.float64s, Float64Array);
         return $;
     }
 };
@@ -444,14 +444,14 @@ paddle.lite.fbs.proto.OpVersionMap_.OpVersionPair = class OpVersionPair {
     static decode(reader, position) {
         const $ = new paddle.lite.fbs.proto.OpVersionMap_.OpVersionPair();
         $.op_name = reader.string_(position, 4, null);
-        $.op_version = reader.table(position, 6, paddle.lite.fbs.proto.OpVersion.decode);
+        $.op_version = reader.table(position, 6, paddle.lite.fbs.proto.OpVersion);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new paddle.lite.fbs.proto.OpVersionMap_.OpVersionPair();
         $.op_name = reader.value(json.op_name, null);
-        $.op_version = reader.object(json.op_version, paddle.lite.fbs.proto.OpVersion.decodeText);
+        $.op_version = reader.object(json.op_version, paddle.lite.fbs.proto.OpVersion);
         return $;
     }
 };
@@ -472,7 +472,7 @@ paddle.lite.fbs.proto.ParamDesc_.LoDTensorDesc = class LoDTensorDesc {
         $.lod = reader.int64s_(position, 6);
         $.dim = reader.int64s_(position, 8);
         $.data_type = reader.int32_(position, 10, 0);
-        $.data = reader.typedArray(position, 12, Int8Array);
+        $.data = reader.array(position, 12, Int8Array);
         return $;
     }
 
@@ -482,7 +482,7 @@ paddle.lite.fbs.proto.ParamDesc_.LoDTensorDesc = class LoDTensorDesc {
         $.lod = reader.array(json.lod);
         $.dim = reader.array(json.dim);
         $.data_type = paddle.lite.fbs.proto.VarType_.Type[json.data_type];
-        $.data = reader.typedArray(json.data, Int8Array);
+        $.data = reader.array(json.data, Int8Array);
         return $;
     }
 };

+ 59 - 59
source/pytorch-schema.js

@@ -53,8 +53,8 @@ torch.jit.mobile.serialization.QuantizedSchema = class QuantizedSchema {
         $.qscheme = reader.int8_(position, 4, 0);
         $.scale = reader.float64_(position, 6, 0);
         $.zero_point = reader.int32_(position, 8, 0);
-        $.scales = reader.table(position, 10, torch.jit.mobile.serialization.TensorMetadata.decode);
-        $.zero_points = reader.table(position, 12, torch.jit.mobile.serialization.TensorMetadata.decode);
+        $.scales = reader.table(position, 10, torch.jit.mobile.serialization.TensorMetadata);
+        $.zero_points = reader.table(position, 12, torch.jit.mobile.serialization.TensorMetadata);
         $.axis = reader.int32_(position, 14, 0);
         return $;
     }
@@ -67,10 +67,10 @@ torch.jit.mobile.serialization.TensorMetadata = class TensorMetadata {
         $.storage_location_index = reader.uint32_(position, 4, 0);
         $.scalar_type = reader.int8_(position, 6, 0);
         $.storage_offset = reader.int32_(position, 8, 0);
-        $.sizes = reader.typedArray(position, 10, Int32Array);
-        $.strides = reader.typedArray(position, 12, Int32Array);
+        $.sizes = reader.array(position, 10, Int32Array);
+        $.strides = reader.array(position, 12, Int32Array);
         $.requires_grad = reader.bool_(position, 14, false);
-        $.quantized_schema = reader.table(position, 16, torch.jit.mobile.serialization.QuantizedSchema.decode);
+        $.quantized_schema = reader.table(position, 16, torch.jit.mobile.serialization.QuantizedSchema);
         return $;
     }
 };
@@ -97,7 +97,7 @@ torch.jit.mobile.serialization.List = class List {
 
     static decode(reader, position) {
         const $ = new torch.jit.mobile.serialization.List();
-        $.items = reader.typedArray(position, 4, Uint32Array);
+        $.items = reader.array(position, 4, Uint32Array);
         $.annotation_str = reader.string_(position, 6, null);
         return $;
     }
@@ -116,7 +116,7 @@ torch.jit.mobile.serialization.DoubleList = class DoubleList {
 
     static decode(reader, position) {
         const $ = new torch.jit.mobile.serialization.DoubleList();
-        $.items = reader.typedArray(position, 4, Float64Array);
+        $.items = reader.array(position, 4, Float64Array);
         return $;
     }
 };
@@ -134,7 +134,7 @@ torch.jit.mobile.serialization.Tuple = class Tuple {
 
     static decode(reader, position) {
         const $ = new torch.jit.mobile.serialization.Tuple();
-        $.items = reader.typedArray(position, 4, Uint32Array);
+        $.items = reader.array(position, 4, Uint32Array);
         return $;
     }
 };
@@ -143,8 +143,8 @@ torch.jit.mobile.serialization.Dict = class Dict {
 
     static decode(reader, position) {
         const $ = new torch.jit.mobile.serialization.Dict();
-        $.keys = reader.typedArray(position, 4, Uint32Array);
-        $.values = reader.typedArray(position, 6, Uint32Array);
+        $.keys = reader.array(position, 4, Uint32Array);
+        $.values = reader.array(position, 6, Uint32Array);
         $.annotation_str = reader.string_(position, 8, null);
         return $;
     }
@@ -175,7 +175,7 @@ torch.jit.mobile.serialization.Object = class Object {
         const $ = new torch.jit.mobile.serialization.Object();
         $.type_index = reader.uint32_(position, 4, 0);
         $.state = reader.uint32_(position, 6, 0);
-        $.attrs = reader.typedArray(position, 8, Uint32Array);
+        $.attrs = reader.array(position, 8, Uint32Array);
         $.setstate_func = reader.uint32_(position, 10, 0);
         return $;
     }
@@ -238,8 +238,8 @@ torch.jit.mobile.serialization.Schema = class Schema {
 
     static decode(reader, position) {
         const $ = new torch.jit.mobile.serialization.Schema();
-        $.arguments = reader.tableArray(position, 4, torch.jit.mobile.serialization.Arg.decode);
-        $.returns = reader.tableArray(position, 6, torch.jit.mobile.serialization.Arg.decode);
+        $.arguments = reader.tables(position, 4, torch.jit.mobile.serialization.Arg);
+        $.returns = reader.tables(position, 6, torch.jit.mobile.serialization.Arg);
         return $;
     }
 };
@@ -258,13 +258,13 @@ torch.jit.mobile.serialization.Function = class Function {
     static decode(reader, position) {
         const $ = new torch.jit.mobile.serialization.Function();
         $.qn = reader.string_(position, 4, null);
-        $.instructions = reader.structArray(position, 6, torch.jit.mobile.serialization.Instruction.decode);
-        $.operators = reader.tableArray(position, 8, torch.jit.mobile.serialization.Operator.decode);
-        $.constants = reader.typedArray(position, 10, Uint32Array);
+        $.instructions = reader.structs(position, 6, torch.jit.mobile.serialization.Instruction);
+        $.operators = reader.tables(position, 8, torch.jit.mobile.serialization.Operator);
+        $.constants = reader.array(position, 10, Uint32Array);
         $.type_annotations = reader.strings_(position, 12);
         $.register_size = reader.int32_(position, 14, 0);
-        $.schema = reader.table(position, 16, torch.jit.mobile.serialization.Schema.decode);
-        $.debug_info = reader.table(position, 18, torch.jit.mobile.serialization.DebugInfo.decode);
+        $.schema = reader.table(position, 16, torch.jit.mobile.serialization.Schema);
+        $.debug_info = reader.table(position, 18, torch.jit.mobile.serialization.DebugInfo);
         $.class_type = reader.uint32_(position, 20, 0);
         return $;
     }
@@ -274,7 +274,7 @@ torch.jit.mobile.serialization.StorageData = class StorageData {
 
     static decode(reader, position) {
         const $ = new torch.jit.mobile.serialization.StorageData();
-        $.data = reader.typedArray(position, 4, Uint8Array);
+        $.data = reader.array(position, 4, Uint8Array);
         return $;
     }
 };
@@ -308,7 +308,7 @@ torch.jit.mobile.serialization.IValue = class IValue {
 
     static decode(reader, position) {
         const $ = new torch.jit.mobile.serialization.IValue();
-        $.val = reader.union(position, 4, torch.jit.mobile.serialization.IValueUnion.decode);
+        $.val = reader.union(position, 4, torch.jit.mobile.serialization.IValueUnion);
         return $;
     }
 };
@@ -336,15 +336,15 @@ torch.jit.mobile.serialization.Module = class Module {
     static decode(reader, position) {
         const $ = new torch.jit.mobile.serialization.Module();
         $.bytecode_version = reader.uint32_(position, 4, 0);
-        $.extra_files = reader.tableArray(position, 6, torch.jit.mobile.serialization.ExtraFile.decode);
-        $.methods = reader.typedArray(position, 8, Uint32Array);
+        $.extra_files = reader.tables(position, 6, torch.jit.mobile.serialization.ExtraFile);
+        $.methods = reader.array(position, 8, Uint32Array);
         $.state_obj = reader.uint32_(position, 10, 0);
-        $.ivalues = reader.tableArray(position, 12, torch.jit.mobile.serialization.IValue.decode);
+        $.ivalues = reader.tables(position, 12, torch.jit.mobile.serialization.IValue);
         $.storage_data_size = reader.int32_(position, 14, 0);
-        $.storage_data = reader.tableArray(position, 16, torch.jit.mobile.serialization.StorageData.decode);
-        $.object_types = reader.tableArray(position, 18, torch.jit.mobile.serialization.ObjectType.decode);
-        $.jit_sources = reader.tableArray(position, 20, torch.jit.mobile.serialization.ExtraFile.decode);
-        $.jit_constants = reader.typedArray(position, 22, Uint32Array);
+        $.storage_data = reader.tables(position, 16, torch.jit.mobile.serialization.StorageData);
+        $.object_types = reader.tables(position, 18, torch.jit.mobile.serialization.ObjectType);
+        $.jit_sources = reader.tables(position, 20, torch.jit.mobile.serialization.ExtraFile);
+        $.jit_constants = reader.array(position, 22, Uint32Array);
         $.operator_version = reader.uint32_(position, 24, 0);
         $.mobile_ivalue_size = reader.uint32_(position, 26, 0);
         return $;
@@ -409,11 +409,11 @@ executorch_flatbuffer.Tensor = class Tensor {
         const $ = new executorch_flatbuffer.Tensor();
         $.scalar_type = reader.int8_(position, 4, 0);
         $.storage_offset = reader.int32_(position, 6, 0);
-        $.sizes = reader.typedArray(position, 8, Int32Array);
-        $.dim_order = reader.typedArray(position, 10, Uint8Array);
+        $.sizes = reader.array(position, 8, Int32Array);
+        $.dim_order = reader.array(position, 10, Uint8Array);
         $.requires_grad = reader.bool_(position, 12, false);
         $.constant_buffer_idx = reader.uint32_(position, 14, 0);
-        $.allocation_info = reader.table(position, 16, executorch_flatbuffer.AllocationDetails.decode);
+        $.allocation_info = reader.table(position, 16, executorch_flatbuffer.AllocationDetails);
         $.layout = reader.int8_(position, 18, 0);
         $.shape_dynamism = reader.int8_(position, 20, 0);
         return $;
@@ -469,7 +469,7 @@ executorch_flatbuffer.DoubleList = class DoubleList {
 
     static decode(reader, position) {
         const $ = new executorch_flatbuffer.DoubleList();
-        $.items = reader.typedArray(position, 4, Float64Array);
+        $.items = reader.array(position, 4, Float64Array);
         return $;
     }
 };
@@ -487,7 +487,7 @@ executorch_flatbuffer.TensorList = class TensorList {
 
     static decode(reader, position) {
         const $ = new executorch_flatbuffer.TensorList();
-        $.items = reader.typedArray(position, 4, Int32Array);
+        $.items = reader.array(position, 4, Int32Array);
         return $;
     }
 };
@@ -496,7 +496,7 @@ executorch_flatbuffer.OptionalTensorList = class OptionalTensorList {
 
     static decode(reader, position) {
         const $ = new executorch_flatbuffer.OptionalTensorList();
-        $.items = reader.typedArray(position, 4, Int32Array);
+        $.items = reader.array(position, 4, Int32Array);
         return $;
     }
 };
@@ -525,7 +525,7 @@ executorch_flatbuffer.EValue = class EValue {
 
     static decode(reader, position) {
         const $ = new executorch_flatbuffer.EValue();
-        $.val = reader.union(position, 4, executorch_flatbuffer.KernelTypes.decode);
+        $.val = reader.union(position, 4, executorch_flatbuffer.KernelTypes);
         return $;
     }
 };
@@ -545,7 +545,7 @@ executorch_flatbuffer.KernelCall = class KernelCall {
     static decode(reader, position) {
         const $ = new executorch_flatbuffer.KernelCall();
         $.op_index = reader.int32_(position, 4, 0);
-        $.args = reader.typedArray(position, 6, Int32Array);
+        $.args = reader.array(position, 6, Int32Array);
         return $;
     }
 };
@@ -555,7 +555,7 @@ executorch_flatbuffer.DelegateCall = class DelegateCall {
     static decode(reader, position) {
         const $ = new executorch_flatbuffer.DelegateCall();
         $.delegate_index = reader.int32_(position, 4, 0);
-        $.args = reader.typedArray(position, 6, Int32Array);
+        $.args = reader.array(position, 6, Int32Array);
         return $;
     }
 };
@@ -607,7 +607,7 @@ executorch_flatbuffer.Instruction = class Instruction {
 
     static decode(reader, position) {
         const $ = new executorch_flatbuffer.Instruction();
-        $.instr_args = reader.union(position, 4, executorch_flatbuffer.InstructionArguments.decode);
+        $.instr_args = reader.union(position, 4, executorch_flatbuffer.InstructionArguments);
         return $;
     }
 };
@@ -628,7 +628,7 @@ executorch_flatbuffer.FrameList = class FrameList {
 
     static decode(reader, position) {
         const $ = new executorch_flatbuffer.FrameList();
-        $.items = reader.tableArray(position, 4, executorch_flatbuffer.Frame.decode);
+        $.items = reader.tables(position, 4, executorch_flatbuffer.Frame);
         return $;
     }
 };
@@ -653,7 +653,7 @@ executorch_flatbuffer.CompileSpec = class CompileSpec {
     static decode(reader, position) {
         const $ = new executorch_flatbuffer.CompileSpec();
         $.key = reader.string_(position, 4, null);
-        $.value = reader.typedArray(position, 6, Uint8Array);
+        $.value = reader.array(position, 6, Uint8Array);
         return $;
     }
 };
@@ -663,8 +663,8 @@ executorch_flatbuffer.BackendDelegate = class BackendDelegate {
     static decode(reader, position) {
         const $ = new executorch_flatbuffer.BackendDelegate();
         $.id = reader.string_(position, 4, null);
-        $.processed = reader.table(position, 6, executorch_flatbuffer.BackendDelegateDataReference.decode);
-        $.compile_specs = reader.tableArray(position, 8, executorch_flatbuffer.CompileSpec.decode);
+        $.processed = reader.table(position, 6, executorch_flatbuffer.BackendDelegateDataReference);
+        $.compile_specs = reader.tables(position, 8, executorch_flatbuffer.CompileSpec);
         return $;
     }
 };
@@ -673,10 +673,10 @@ executorch_flatbuffer.Chain = class Chain {
 
     static decode(reader, position) {
         const $ = new executorch_flatbuffer.Chain();
-        $.inputs = reader.typedArray(position, 4, Int32Array);
-        $.outputs = reader.typedArray(position, 6, Int32Array);
-        $.instructions = reader.tableArray(position, 8, executorch_flatbuffer.Instruction.decode);
-        $.stacktrace = reader.tableArray(position, 10, executorch_flatbuffer.FrameList.decode);
+        $.inputs = reader.array(position, 4, Int32Array);
+        $.outputs = reader.array(position, 6, Int32Array);
+        $.instructions = reader.tables(position, 8, executorch_flatbuffer.Instruction);
+        $.stacktrace = reader.tables(position, 10, executorch_flatbuffer.FrameList);
         return $;
     }
 };
@@ -686,13 +686,13 @@ executorch_flatbuffer.ExecutionPlan = class ExecutionPlan {
     static decode(reader, position) {
         const $ = new executorch_flatbuffer.ExecutionPlan();
         $.name = reader.string_(position, 4, null);
-        $.container_meta_type = reader.table(position, 6, executorch_flatbuffer.ContainerMetadata.decode);
-        $.values = reader.tableArray(position, 8, executorch_flatbuffer.EValue.decode);
-        $.inputs = reader.typedArray(position, 10, Int32Array);
-        $.outputs = reader.typedArray(position, 12, Int32Array);
-        $.chains = reader.tableArray(position, 14, executorch_flatbuffer.Chain.decode);
-        $.operators = reader.tableArray(position, 16, executorch_flatbuffer.Operator.decode);
-        $.delegates = reader.tableArray(position, 18, executorch_flatbuffer.BackendDelegate.decode);
+        $.container_meta_type = reader.table(position, 6, executorch_flatbuffer.ContainerMetadata);
+        $.values = reader.tables(position, 8, executorch_flatbuffer.EValue);
+        $.inputs = reader.array(position, 10, Int32Array);
+        $.outputs = reader.array(position, 12, Int32Array);
+        $.chains = reader.tables(position, 14, executorch_flatbuffer.Chain);
+        $.operators = reader.tables(position, 16, executorch_flatbuffer.Operator);
+        $.delegates = reader.tables(position, 18, executorch_flatbuffer.BackendDelegate);
         $.non_const_buffer_sizes = reader.int64s_(position, 20);
         return $;
     }
@@ -702,7 +702,7 @@ executorch_flatbuffer.Buffer = class Buffer {
 
     static decode(reader, position) {
         const $ = new executorch_flatbuffer.Buffer();
-        $.storage = reader.typedArray(position, 4, Uint8Array);
+        $.storage = reader.array(position, 4, Uint8Array);
         return $;
     }
 };
@@ -711,7 +711,7 @@ executorch_flatbuffer.BackendDelegateInlineData = class BackendDelegateInlineDat
 
     static decode(reader, position) {
         const $ = new executorch_flatbuffer.BackendDelegateInlineData();
-        $.data = reader.typedArray(position, 4, Uint8Array);
+        $.data = reader.array(position, 4, Uint8Array);
         return $;
     }
 };
@@ -749,11 +749,11 @@ executorch_flatbuffer.Program = class Program {
     static decode(reader, position) {
         const $ = new executorch_flatbuffer.Program();
         $.version = reader.uint32_(position, 4, 0);
-        $.execution_plan = reader.tableArray(position, 6, executorch_flatbuffer.ExecutionPlan.decode);
-        $.constant_buffer = reader.tableArray(position, 8, executorch_flatbuffer.Buffer.decode);
-        $.backend_delegate_data = reader.tableArray(position, 10, executorch_flatbuffer.BackendDelegateInlineData.decode);
-        $.segments = reader.tableArray(position, 12, executorch_flatbuffer.DataSegment.decode);
-        $.constant_segment = reader.table(position, 14, executorch_flatbuffer.SubsegmentOffsets.decode);
+        $.execution_plan = reader.tables(position, 6, executorch_flatbuffer.ExecutionPlan);
+        $.constant_buffer = reader.tables(position, 8, executorch_flatbuffer.Buffer);
+        $.backend_delegate_data = reader.tables(position, 10, executorch_flatbuffer.BackendDelegateInlineData);
+        $.segments = reader.tables(position, 12, executorch_flatbuffer.DataSegment);
+        $.constant_segment = reader.table(position, 14, executorch_flatbuffer.SubsegmentOffsets);
         return $;
     }
 };

+ 20 - 20
source/rknn-schema.js

@@ -15,9 +15,9 @@ rknn.Model = class Model {
         const $ = new rknn.Model();
         $.var1 = reader.int32_(position, 4, 0);
         $.format = reader.string_(position, 6, null);
-        $.graphs = reader.tableArray(position, 8, rknn.Graph.decode);
+        $.graphs = reader.tables(position, 8, rknn.Graph);
         $.generator = reader.string_(position, 10, null);
-        $.var2 = reader.tableArray(position, 12, rknn.Type1.decode);
+        $.var2 = reader.tables(position, 12, rknn.Type1);
         $.var3 = reader.int32_(position, 14, 0);
         $.var4 = reader.int32_(position, 16, 0);
         $.compiler = reader.string_(position, 18, null);
@@ -35,11 +35,11 @@ rknn.Graph = class Graph {
 
     static decode(reader, position) {
         const $ = new rknn.Graph();
-        $.tensors = reader.tableArray(position, 4, rknn.Tensor.decode);
-        $.nodes = reader.tableArray(position, 6, rknn.Node.decode);
-        $.inputs = reader.typedArray(position, 8, Int32Array);
-        $.outputs = reader.typedArray(position, 10, Int32Array);
-        $.var1 = reader.tableArray(position, 12, rknn.Type2.decode);
+        $.tensors = reader.tables(position, 4, rknn.Tensor);
+        $.nodes = reader.tables(position, 6, rknn.Node);
+        $.inputs = reader.array(position, 8, Int32Array);
+        $.outputs = reader.array(position, 10, Int32Array);
+        $.var1 = reader.tables(position, 12, rknn.Type2);
         return $;
     }
 };
@@ -52,9 +52,9 @@ rknn.Node = class Node {
         $.type = reader.string_(position, 6, null);
         $.name = reader.string_(position, 8, null);
         $.var2 = reader.int8_(position, 10, 0);
-        $.inputs = reader.typedArray(position, 12, Int32Array);
-        $.outputs = reader.typedArray(position, 14, Int32Array);
-        $.var3 = reader.tableArray(position, 16, rknn.Type3.decode);
+        $.inputs = reader.array(position, 12, Int32Array);
+        $.outputs = reader.array(position, 14, Int32Array);
+        $.var3 = reader.tables(position, 16, rknn.Type3);
         $.var4 = reader.int8_(position, 18, 0);
         $.var5 = reader.int32_(position, 20, 0);
         $.var6 = reader.int32_(position, 22, 0);
@@ -69,15 +69,15 @@ rknn.Tensor = class Tensor {
         $.data_type = reader.int8_(position, 4, 0);
         $.var02 = reader.int8_(position, 6, 0);
         $.kind = reader.int8_(position, 8, 0);
-        $.var04 = reader.typedArray(position, 10, Int32Array);
-        $.shape = reader.typedArray(position, 12, Int32Array);
+        $.var04 = reader.array(position, 10, Int32Array);
+        $.shape = reader.array(position, 12, Int32Array);
         $.name = reader.string_(position, 14, null);
-        $.var06 = reader.typedArray(position, 16, Int8Array);
+        $.var06 = reader.array(position, 16, Int8Array);
         $.var07 = reader.string_(position, 18, null);
-        $.var08 = reader.typedArray(position, 20, Int8Array);
-        $.var09 = reader.typedArray(position, 22, Int8Array);
-        $.var10 = reader.typedArray(position, 24, Int8Array);
-        $.var11 = reader.typedArray(position, 26, Int8Array);
+        $.var08 = reader.array(position, 20, Int8Array);
+        $.var09 = reader.array(position, 22, Int8Array);
+        $.var10 = reader.array(position, 24, Int8Array);
+        $.var11 = reader.array(position, 26, Int8Array);
         $.size = reader.int32_(position, 28, 0);
         $.var13 = reader.int32_(position, 30, 0);
         $.var14 = reader.int32_(position, 32, 0);
@@ -102,9 +102,9 @@ rknn.Type2 = class Type2 {
 
     static decode(reader, position) {
         const $ = new rknn.Type2();
-        $.var1 = reader.typedArray(position, 4, Int32Array);
-        $.var2 = reader.typedArray(position, 6, Int32Array);
-        $.var3 = reader.typedArray(position, 8, Int32Array);
+        $.var1 = reader.array(position, 4, Int32Array);
+        $.var2 = reader.array(position, 6, Int32Array);
+        $.var3 = reader.array(position, 8, Int32Array);
         return $;
     }
 };

+ 143 - 143
source/tflite-schema.js

@@ -27,13 +27,13 @@ tflite.CustomQuantization = class CustomQuantization {
 
     static decode(reader, position) {
         const $ = new tflite.CustomQuantization();
-        $.custom = reader.typedArray(position, 4, Uint8Array);
+        $.custom = reader.array(position, 4, Uint8Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.CustomQuantization();
-        $.custom = reader.typedArray(json.custom, Uint8Array);
+        $.custom = reader.array(json.custom, Uint8Array);
         return $;
     }
 };
@@ -59,20 +59,20 @@ tflite.QuantizationParameters = class QuantizationParameters {
 
     static decode(reader, position) {
         const $ = new tflite.QuantizationParameters();
-        $.min = reader.typedArray(position, 4, Float32Array);
-        $.max = reader.typedArray(position, 6, Float32Array);
-        $.scale = reader.typedArray(position, 8, Float32Array);
+        $.min = reader.array(position, 4, Float32Array);
+        $.max = reader.array(position, 6, Float32Array);
+        $.scale = reader.array(position, 8, Float32Array);
         $.zero_point = reader.int64s_(position, 10);
-        $.details = reader.union(position, 12, tflite.QuantizationDetails.decode);
+        $.details = reader.union(position, 12, tflite.QuantizationDetails);
         $.quantized_dimension = reader.int32_(position, 16, 0);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.QuantizationParameters();
-        $.min = reader.typedArray(json.min, Float32Array);
-        $.max = reader.typedArray(json.max, Float32Array);
-        $.scale = reader.typedArray(json.scale, Float32Array);
+        $.min = reader.array(json.min, Float32Array);
+        $.max = reader.array(json.max, Float32Array);
+        $.scale = reader.array(json.scale, Float32Array);
         $.zero_point = reader.array(json.zero_point);
         $.details = tflite.QuantizationDetails.decodeText(reader, json.details, json.details_type);
         $.quantized_dimension = reader.value(json.quantized_dimension, 0);
@@ -89,13 +89,13 @@ tflite.Int32Vector = class Int32Vector {
 
     static decode(reader, position) {
         const $ = new tflite.Int32Vector();
-        $.values = reader.typedArray(position, 4, Int32Array);
+        $.values = reader.array(position, 4, Int32Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.Int32Vector();
-        $.values = reader.typedArray(json.values, Int32Array);
+        $.values = reader.array(json.values, Int32Array);
         return $;
     }
 };
@@ -104,13 +104,13 @@ tflite.Uint16Vector = class Uint16Vector {
 
     static decode(reader, position) {
         const $ = new tflite.Uint16Vector();
-        $.values = reader.typedArray(position, 4, Uint16Array);
+        $.values = reader.array(position, 4, Uint16Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.Uint16Vector();
-        $.values = reader.typedArray(json.values, Uint16Array);
+        $.values = reader.array(json.values, Uint16Array);
         return $;
     }
 };
@@ -119,13 +119,13 @@ tflite.Uint8Vector = class Uint8Vector {
 
     static decode(reader, position) {
         const $ = new tflite.Uint8Vector();
-        $.values = reader.typedArray(position, 4, Uint8Array);
+        $.values = reader.array(position, 4, Uint8Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.Uint8Vector();
-        $.values = reader.typedArray(json.values, Uint8Array);
+        $.values = reader.array(json.values, Uint8Array);
         return $;
     }
 };
@@ -157,8 +157,8 @@ tflite.DimensionMetadata = class DimensionMetadata {
         const $ = new tflite.DimensionMetadata();
         $.format = reader.int8_(position, 4, 0);
         $.dense_size = reader.int32_(position, 6, 0);
-        $.array_segments = reader.union(position, 8, tflite.SparseIndexVector.decode);
-        $.array_indices = reader.union(position, 12, tflite.SparseIndexVector.decode);
+        $.array_segments = reader.union(position, 8, tflite.SparseIndexVector);
+        $.array_indices = reader.union(position, 12, tflite.SparseIndexVector);
         return $;
     }
 
@@ -176,17 +176,17 @@ tflite.SparsityParameters = class SparsityParameters {
 
     static decode(reader, position) {
         const $ = new tflite.SparsityParameters();
-        $.traversal_order = reader.typedArray(position, 4, Int32Array);
-        $.block_map = reader.typedArray(position, 6, Int32Array);
-        $.dim_metadata = reader.tableArray(position, 8, tflite.DimensionMetadata.decode);
+        $.traversal_order = reader.array(position, 4, Int32Array);
+        $.block_map = reader.array(position, 6, Int32Array);
+        $.dim_metadata = reader.tables(position, 8, tflite.DimensionMetadata);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.SparsityParameters();
-        $.traversal_order = reader.typedArray(json.traversal_order, Int32Array);
-        $.block_map = reader.typedArray(json.block_map, Int32Array);
-        $.dim_metadata = reader.objectArray(json.dim_metadata, tflite.DimensionMetadata.decodeText);
+        $.traversal_order = reader.array(json.traversal_order, Int32Array);
+        $.block_map = reader.array(json.block_map, Int32Array);
+        $.dim_metadata = reader.objects(json.dim_metadata, tflite.DimensionMetadata);
         return $;
     }
 };
@@ -195,7 +195,7 @@ tflite.VariantSubType = class VariantSubType {
 
     static decode(reader, position) {
         const $ = new tflite.VariantSubType();
-        $.shape = reader.typedArray(position, 4, Int32Array);
+        $.shape = reader.array(position, 4, Int32Array);
         $.type = reader.int8_(position, 6, 0);
         $.has_rank = reader.bool_(position, 8, false);
         return $;
@@ -203,7 +203,7 @@ tflite.VariantSubType = class VariantSubType {
 
     static decodeText(reader, json) {
         const $ = new tflite.VariantSubType();
-        $.shape = reader.typedArray(json.shape, Int32Array);
+        $.shape = reader.array(json.shape, Int32Array);
         $.type = tflite.TensorType[json.type];
         $.has_rank = reader.value(json.has_rank, false);
         return $;
@@ -214,31 +214,31 @@ tflite.Tensor = class Tensor {
 
     static decode(reader, position) {
         const $ = new tflite.Tensor();
-        $.shape = reader.typedArray(position, 4, Int32Array);
+        $.shape = reader.array(position, 4, Int32Array);
         $.type = reader.int8_(position, 6, 0);
         $.buffer = reader.uint32_(position, 8, 0);
         $.name = reader.string_(position, 10, null);
-        $.quantization = reader.table(position, 12, tflite.QuantizationParameters.decode);
+        $.quantization = reader.table(position, 12, tflite.QuantizationParameters);
         $.is_variable = reader.bool_(position, 14, false);
-        $.sparsity = reader.table(position, 16, tflite.SparsityParameters.decode);
-        $.shape_signature = reader.typedArray(position, 18, Int32Array);
+        $.sparsity = reader.table(position, 16, tflite.SparsityParameters);
+        $.shape_signature = reader.array(position, 18, Int32Array);
         $.has_rank = reader.bool_(position, 20, false);
-        $.variant_tensors = reader.tableArray(position, 22, tflite.VariantSubType.decode);
+        $.variant_tensors = reader.tables(position, 22, tflite.VariantSubType);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.Tensor();
-        $.shape = reader.typedArray(json.shape, Int32Array);
+        $.shape = reader.array(json.shape, Int32Array);
         $.type = tflite.TensorType[json.type];
         $.buffer = reader.value(json.buffer, 0);
         $.name = reader.value(json.name, null);
-        $.quantization = reader.object(json.quantization, tflite.QuantizationParameters.decodeText);
+        $.quantization = reader.object(json.quantization, tflite.QuantizationParameters);
         $.is_variable = reader.value(json.is_variable, false);
-        $.sparsity = reader.object(json.sparsity, tflite.SparsityParameters.decodeText);
-        $.shape_signature = reader.typedArray(json.shape_signature, Int32Array);
+        $.sparsity = reader.object(json.sparsity, tflite.SparsityParameters);
+        $.shape_signature = reader.array(json.shape_signature, Int32Array);
         $.has_rank = reader.value(json.has_rank, false);
-        $.variant_tensors = reader.objectArray(json.variant_tensors, tflite.VariantSubType.decodeText);
+        $.variant_tensors = reader.objects(json.variant_tensors, tflite.VariantSubType);
         return $;
     }
 };
@@ -828,7 +828,7 @@ tflite.StablehloDotGeneralOptions = class StablehloDotGeneralOptions {
         $.rhs_batching_dimensions = reader.int64s_(position, 6);
         $.lhs_contracting_dimensions = reader.int64s_(position, 8);
         $.rhs_contracting_dimensions = reader.int64s_(position, 10);
-        $.precision_config = reader.typedArray(position, 12, Uint32Array);
+        $.precision_config = reader.array(position, 12, Uint32Array);
         return $;
     }
 
@@ -838,7 +838,7 @@ tflite.StablehloDotGeneralOptions = class StablehloDotGeneralOptions {
         $.rhs_batching_dimensions = reader.array(json.rhs_batching_dimensions);
         $.lhs_contracting_dimensions = reader.array(json.lhs_contracting_dimensions);
         $.rhs_contracting_dimensions = reader.array(json.rhs_contracting_dimensions);
-        $.precision_config = reader.objectArray(json.precision_config, tflite.StablehloPrecisionConfig.decodeText);
+        $.precision_config = reader.objects(json.precision_config, tflite.StablehloPrecisionConfig);
         return $;
     }
 };
@@ -1025,8 +1025,8 @@ tflite.StablehloCustomCallOptions = class StablehloCustomCallOptions {
         $.has_side_effect = reader.bool_(position, 6, false);
         $.backend_config = reader.string_(position, 8, null);
         $.api_version = reader.int32_(position, 10, 0);
-        $.called_computations = reader.typedArray(position, 12, Int32Array);
-        $.custom_attributes = reader.typedArray(position, 14, Uint8Array);
+        $.called_computations = reader.array(position, 12, Int32Array);
+        $.custom_attributes = reader.array(position, 14, Uint8Array);
         return $;
     }
 
@@ -1036,8 +1036,8 @@ tflite.StablehloCustomCallOptions = class StablehloCustomCallOptions {
         $.has_side_effect = reader.value(json.has_side_effect, false);
         $.backend_config = reader.value(json.backend_config, null);
         $.api_version = reader.value(json.api_version, 0);
-        $.called_computations = reader.typedArray(json.called_computations, Int32Array);
-        $.custom_attributes = reader.typedArray(json.custom_attributes, Uint8Array);
+        $.called_computations = reader.array(json.called_computations, Int32Array);
+        $.custom_attributes = reader.array(json.custom_attributes, Uint8Array);
         return $;
     }
 };
@@ -1098,7 +1098,7 @@ tflite.StablehloConvolutionOptions = class StablehloConvolutionOptions {
         $.output_spatial_dimensions = reader.int64s_(position, 30);
         $.feature_group_count = reader.int64_(position, 32, 0n);
         $.batch_group_count = reader.int64_(position, 34, 0n);
-        $.precision_config = reader.typedArray(position, 36, Uint32Array);
+        $.precision_config = reader.array(position, 36, Uint32Array);
         return $;
     }
 
@@ -1120,7 +1120,7 @@ tflite.StablehloConvolutionOptions = class StablehloConvolutionOptions {
         $.output_spatial_dimensions = reader.array(json.output_spatial_dimensions);
         $.feature_group_count = reader.int64(json.feature_group_count, 0n);
         $.batch_group_count = reader.int64(json.batch_group_count, 0n);
-        $.precision_config = reader.objectArray(json.precision_config, tflite.StablehloPrecisionConfig.decodeText);
+        $.precision_config = reader.objects(json.precision_config, tflite.StablehloPrecisionConfig);
         return $;
     }
 };
@@ -1300,16 +1300,16 @@ tflite.ConcatEmbeddingsOptions = class ConcatEmbeddingsOptions {
     static decode(reader, position) {
         const $ = new tflite.ConcatEmbeddingsOptions();
         $.num_channels = reader.int32_(position, 4, 0);
-        $.num_columns_per_channel = reader.typedArray(position, 6, Int32Array);
-        $.embedding_dim_per_channel = reader.typedArray(position, 8, Int32Array);
+        $.num_columns_per_channel = reader.array(position, 6, Int32Array);
+        $.embedding_dim_per_channel = reader.array(position, 8, Int32Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.ConcatEmbeddingsOptions();
         $.num_channels = reader.value(json.num_channels, 0);
-        $.num_columns_per_channel = reader.typedArray(json.num_columns_per_channel, Int32Array);
-        $.embedding_dim_per_channel = reader.typedArray(json.embedding_dim_per_channel, Int32Array);
+        $.num_columns_per_channel = reader.array(json.num_columns_per_channel, Int32Array);
+        $.embedding_dim_per_channel = reader.array(json.embedding_dim_per_channel, Int32Array);
         return $;
     }
 };
@@ -1700,13 +1700,13 @@ tflite.ReshapeOptions = class ReshapeOptions {
 
     static decode(reader, position) {
         const $ = new tflite.ReshapeOptions();
-        $.new_shape = reader.typedArray(position, 4, Int32Array);
+        $.new_shape = reader.array(position, 4, Int32Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.ReshapeOptions();
-        $.new_shape = reader.typedArray(json.new_shape, Int32Array);
+        $.new_shape = reader.array(json.new_shape, Int32Array);
         return $;
     }
 };
@@ -1927,13 +1927,13 @@ tflite.SqueezeOptions = class SqueezeOptions {
 
     static decode(reader, position) {
         const $ = new tflite.SqueezeOptions();
-        $.squeeze_dims = reader.typedArray(position, 4, Int32Array);
+        $.squeeze_dims = reader.array(position, 4, Int32Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.SqueezeOptions();
-        $.squeeze_dims = reader.typedArray(json.squeeze_dims, Int32Array);
+        $.squeeze_dims = reader.array(json.squeeze_dims, Int32Array);
         return $;
     }
 };
@@ -2996,13 +2996,13 @@ tflite.BucketizeOptions = class BucketizeOptions {
 
     static decode(reader, position) {
         const $ = new tflite.BucketizeOptions();
-        $.boundaries = reader.typedArray(position, 4, Float32Array);
+        $.boundaries = reader.array(position, 4, Float32Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.BucketizeOptions();
-        $.boundaries = reader.typedArray(json.boundaries, Float32Array);
+        $.boundaries = reader.array(json.boundaries, Float32Array);
         return $;
     }
 };
@@ -3220,29 +3220,29 @@ tflite.Operator = class Operator {
     static decode(reader, position) {
         const $ = new tflite.Operator();
         $.opcode_index = reader.uint32_(position, 4, 0);
-        $.inputs = reader.typedArray(position, 6, Int32Array);
-        $.outputs = reader.typedArray(position, 8, Int32Array);
-        $.builtin_options = reader.union(position, 10, tflite.BuiltinOptions.decode);
-        $.custom_options = reader.typedArray(position, 14, Uint8Array);
+        $.inputs = reader.array(position, 6, Int32Array);
+        $.outputs = reader.array(position, 8, Int32Array);
+        $.builtin_options = reader.union(position, 10, tflite.BuiltinOptions);
+        $.custom_options = reader.array(position, 14, Uint8Array);
         $.custom_options_format = reader.int8_(position, 16, 0);
         $.mutating_variable_inputs = reader.bools_(position, 18);
-        $.intermediates = reader.typedArray(position, 20, Int32Array);
+        $.intermediates = reader.array(position, 20, Int32Array);
         $.large_custom_options_offset = reader.uint64_(position, 22, 0n);
         $.large_custom_options_size = reader.uint64_(position, 24, 0n);
-        $.builtin_options_2 = reader.union(position, 26, tflite.BuiltinOptions2.decode);
+        $.builtin_options_2 = reader.union(position, 26, tflite.BuiltinOptions2);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.Operator();
         $.opcode_index = reader.value(json.opcode_index, 0);
-        $.inputs = reader.typedArray(json.inputs, Int32Array);
-        $.outputs = reader.typedArray(json.outputs, Int32Array);
+        $.inputs = reader.array(json.inputs, Int32Array);
+        $.outputs = reader.array(json.outputs, Int32Array);
         $.builtin_options = tflite.BuiltinOptions.decodeText(reader, json.builtin_options, json.builtin_options_type);
-        $.custom_options = reader.typedArray(json.custom_options, Uint8Array);
+        $.custom_options = reader.array(json.custom_options, Uint8Array);
         $.custom_options_format = tflite.CustomOptionsFormat[json.custom_options_format];
         $.mutating_variable_inputs = reader.array(json.mutating_variable_inputs);
-        $.intermediates = reader.typedArray(json.intermediates, Int32Array);
+        $.intermediates = reader.array(json.intermediates, Int32Array);
         $.large_custom_options_offset = reader.uint64(json.large_custom_options_offset, 0n);
         $.large_custom_options_size = reader.uint64(json.large_custom_options_size, 0n);
         $.builtin_options_2 = tflite.BuiltinOptions2.decodeText(reader, json.builtin_options_2, json.builtin_options_2_type);
@@ -3254,20 +3254,20 @@ tflite.SubGraph = class SubGraph {
 
     static decode(reader, position) {
         const $ = new tflite.SubGraph();
-        $.tensors = reader.tableArray(position, 4, tflite.Tensor.decode);
-        $.inputs = reader.typedArray(position, 6, Int32Array);
-        $.outputs = reader.typedArray(position, 8, Int32Array);
-        $.operators = reader.tableArray(position, 10, tflite.Operator.decode);
+        $.tensors = reader.tables(position, 4, tflite.Tensor);
+        $.inputs = reader.array(position, 6, Int32Array);
+        $.outputs = reader.array(position, 8, Int32Array);
+        $.operators = reader.tables(position, 10, tflite.Operator);
         $.name = reader.string_(position, 12, null);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.SubGraph();
-        $.tensors = reader.objectArray(json.tensors, tflite.Tensor.decodeText);
-        $.inputs = reader.typedArray(json.inputs, Int32Array);
-        $.outputs = reader.typedArray(json.outputs, Int32Array);
-        $.operators = reader.objectArray(json.operators, tflite.Operator.decodeText);
+        $.tensors = reader.objects(json.tensors, tflite.Tensor);
+        $.inputs = reader.array(json.inputs, Int32Array);
+        $.outputs = reader.array(json.outputs, Int32Array);
+        $.operators = reader.objects(json.operators, tflite.Operator);
         $.name = reader.value(json.name, null);
         return $;
     }
@@ -3277,7 +3277,7 @@ tflite.Buffer = class Buffer {
 
     static decode(reader, position) {
         const $ = new tflite.Buffer();
-        $.data = reader.typedArray(position, 4, Uint8Array);
+        $.data = reader.array(position, 4, Uint8Array);
         $.offset = reader.uint64_(position, 6, 0n);
         $.size = reader.uint64_(position, 8, 0n);
         return $;
@@ -3285,7 +3285,7 @@ tflite.Buffer = class Buffer {
 
     static decodeText(reader, json) {
         const $ = new tflite.Buffer();
-        $.data = reader.typedArray(json.data, Uint8Array);
+        $.data = reader.array(json.data, Uint8Array);
         $.offset = reader.uint64(json.offset, 0n);
         $.size = reader.uint64(json.size, 0n);
         return $;
@@ -3330,8 +3330,8 @@ tflite.SignatureDef = class SignatureDef {
 
     static decode(reader, position) {
         const $ = new tflite.SignatureDef();
-        $.inputs = reader.tableArray(position, 4, tflite.TensorMap.decode);
-        $.outputs = reader.tableArray(position, 6, tflite.TensorMap.decode);
+        $.inputs = reader.tables(position, 4, tflite.TensorMap);
+        $.outputs = reader.tables(position, 6, tflite.TensorMap);
         $.signature_key = reader.string_(position, 8, null);
         $.deprecated_tag = reader.string_(position, 10, null);
         $.subgraph_index = reader.uint32_(position, 12, 0);
@@ -3340,8 +3340,8 @@ tflite.SignatureDef = class SignatureDef {
 
     static decodeText(reader, json) {
         const $ = new tflite.SignatureDef();
-        $.inputs = reader.objectArray(json.inputs, tflite.TensorMap.decodeText);
-        $.outputs = reader.objectArray(json.outputs, tflite.TensorMap.decodeText);
+        $.inputs = reader.objects(json.inputs, tflite.TensorMap);
+        $.outputs = reader.objects(json.outputs, tflite.TensorMap);
         $.signature_key = reader.value(json.signature_key, null);
         $.deprecated_tag = reader.value(json.deprecated_tag, null);
         $.subgraph_index = reader.value(json.subgraph_index, 0);
@@ -3366,26 +3366,26 @@ tflite.Model = class Model {
     static decode(reader, position) {
         const $ = new tflite.Model();
         $.version = reader.uint32_(position, 4, 0);
-        $.operator_codes = reader.tableArray(position, 6, tflite.OperatorCode.decode);
-        $.subgraphs = reader.tableArray(position, 8, tflite.SubGraph.decode);
+        $.operator_codes = reader.tables(position, 6, tflite.OperatorCode);
+        $.subgraphs = reader.tables(position, 8, tflite.SubGraph);
         $.description = reader.string_(position, 10, null);
-        $.buffers = reader.tableArray(position, 12, tflite.Buffer.decode);
-        $.metadata_buffer = reader.typedArray(position, 14, Int32Array);
-        $.metadata = reader.tableArray(position, 16, tflite.Metadata.decode);
-        $.signature_defs = reader.tableArray(position, 18, tflite.SignatureDef.decode);
+        $.buffers = reader.tables(position, 12, tflite.Buffer);
+        $.metadata_buffer = reader.array(position, 14, Int32Array);
+        $.metadata = reader.tables(position, 16, tflite.Metadata);
+        $.signature_defs = reader.tables(position, 18, tflite.SignatureDef);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.Model();
         $.version = reader.value(json.version, 0);
-        $.operator_codes = reader.objectArray(json.operator_codes, tflite.OperatorCode.decodeText);
-        $.subgraphs = reader.objectArray(json.subgraphs, tflite.SubGraph.decodeText);
+        $.operator_codes = reader.objects(json.operator_codes, tflite.OperatorCode);
+        $.subgraphs = reader.objects(json.subgraphs, tflite.SubGraph);
         $.description = reader.value(json.description, null);
-        $.buffers = reader.objectArray(json.buffers, tflite.Buffer.decodeText);
-        $.metadata_buffer = reader.typedArray(json.metadata_buffer, Int32Array);
-        $.metadata = reader.objectArray(json.metadata, tflite.Metadata.decodeText);
-        $.signature_defs = reader.objectArray(json.signature_defs, tflite.SignatureDef.decodeText);
+        $.buffers = reader.objects(json.buffers, tflite.Buffer);
+        $.metadata_buffer = reader.array(json.metadata_buffer, Int32Array);
+        $.metadata = reader.objects(json.metadata, tflite.Metadata);
+        $.signature_defs = reader.objects(json.signature_defs, tflite.SignatureDef);
         return $;
     }
 };
@@ -3464,14 +3464,14 @@ tflite.ImageProperties = class ImageProperties {
     static decode(reader, position) {
         const $ = new tflite.ImageProperties();
         $.color_space = reader.int8_(position, 4, 0);
-        $.default_size = reader.table(position, 6, tflite.ImageSize.decode);
+        $.default_size = reader.table(position, 6, tflite.ImageSize);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.ImageProperties();
         $.color_space = tflite.ColorSpaceType[json.color_space];
-        $.default_size = reader.object(json.default_size, tflite.ImageSize.decodeText);
+        $.default_size = reader.object(json.default_size, tflite.ImageSize);
         return $;
     }
 };
@@ -3509,7 +3509,7 @@ tflite.BoundingBoxProperties = class BoundingBoxProperties {
 
     static decode(reader, position) {
         const $ = new tflite.BoundingBoxProperties();
-        $.index = reader.typedArray(position, 4, Uint32Array);
+        $.index = reader.array(position, 4, Uint32Array);
         $.type = reader.int8_(position, 6, 0);
         $.coordinate_type = reader.int8_(position, 8, 0);
         return $;
@@ -3517,7 +3517,7 @@ tflite.BoundingBoxProperties = class BoundingBoxProperties {
 
     static decodeText(reader, json) {
         const $ = new tflite.BoundingBoxProperties();
-        $.index = reader.typedArray(json.index, Uint32Array);
+        $.index = reader.array(json.index, Uint32Array);
         $.type = tflite.BoundingBoxType[json.type];
         $.coordinate_type = tflite.CoordinateType[json.coordinate_type];
         return $;
@@ -3568,15 +3568,15 @@ tflite.Content = class Content {
 
     static decode(reader, position) {
         const $ = new tflite.Content();
-        $.content_properties = reader.union(position, 4, tflite.ContentProperties.decode);
-        $.range = reader.table(position, 8, tflite.ValueRange.decode);
+        $.content_properties = reader.union(position, 4, tflite.ContentProperties);
+        $.range = reader.table(position, 8, tflite.ValueRange);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.Content();
         $.content_properties = tflite.ContentProperties.decodeText(reader, json.content_properties, json.content_properties_type);
-        $.range = reader.object(json.range, tflite.ValueRange.decodeText);
+        $.range = reader.object(json.range, tflite.ValueRange);
         return $;
     }
 };
@@ -3585,15 +3585,15 @@ tflite.NormalizationOptions = class NormalizationOptions {
 
     static decode(reader, position) {
         const $ = new tflite.NormalizationOptions();
-        $.mean = reader.typedArray(position, 4, Float32Array);
-        $.std = reader.typedArray(position, 6, Float32Array);
+        $.mean = reader.array(position, 4, Float32Array);
+        $.std = reader.array(position, 6, Float32Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.NormalizationOptions();
-        $.mean = reader.typedArray(json.mean, Float32Array);
-        $.std = reader.typedArray(json.std, Float32Array);
+        $.mean = reader.array(json.mean, Float32Array);
+        $.std = reader.array(json.std, Float32Array);
         return $;
     }
 };
@@ -3640,13 +3640,13 @@ tflite.BertTokenizerOptions = class BertTokenizerOptions {
 
     static decode(reader, position) {
         const $ = new tflite.BertTokenizerOptions();
-        $.vocab_file = reader.tableArray(position, 4, tflite.AssociatedFile.decode);
+        $.vocab_file = reader.tables(position, 4, tflite.AssociatedFile);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.BertTokenizerOptions();
-        $.vocab_file = reader.objectArray(json.vocab_file, tflite.AssociatedFile.decodeText);
+        $.vocab_file = reader.objects(json.vocab_file, tflite.AssociatedFile);
         return $;
     }
 };
@@ -3655,15 +3655,15 @@ tflite.SentencePieceTokenizerOptions = class SentencePieceTokenizerOptions {
 
     static decode(reader, position) {
         const $ = new tflite.SentencePieceTokenizerOptions();
-        $.sentencePiece_model = reader.tableArray(position, 4, tflite.AssociatedFile.decode);
-        $.vocab_file = reader.tableArray(position, 6, tflite.AssociatedFile.decode);
+        $.sentencePiece_model = reader.tables(position, 4, tflite.AssociatedFile);
+        $.vocab_file = reader.tables(position, 6, tflite.AssociatedFile);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.SentencePieceTokenizerOptions();
-        $.sentencePiece_model = reader.objectArray(json.sentencePiece_model, tflite.AssociatedFile.decodeText);
-        $.vocab_file = reader.objectArray(json.vocab_file, tflite.AssociatedFile.decodeText);
+        $.sentencePiece_model = reader.objects(json.sentencePiece_model, tflite.AssociatedFile);
+        $.vocab_file = reader.objects(json.vocab_file, tflite.AssociatedFile);
         return $;
     }
 };
@@ -3673,14 +3673,14 @@ tflite.RegexTokenizerOptions = class RegexTokenizerOptions {
     static decode(reader, position) {
         const $ = new tflite.RegexTokenizerOptions();
         $.delim_regex_pattern = reader.string_(position, 4, null);
-        $.vocab_file = reader.tableArray(position, 6, tflite.AssociatedFile.decode);
+        $.vocab_file = reader.tables(position, 6, tflite.AssociatedFile);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.RegexTokenizerOptions();
         $.delim_regex_pattern = reader.value(json.delim_regex_pattern, null);
-        $.vocab_file = reader.objectArray(json.vocab_file, tflite.AssociatedFile.decodeText);
+        $.vocab_file = reader.objects(json.vocab_file, tflite.AssociatedFile);
         return $;
     }
 };
@@ -3716,7 +3716,7 @@ tflite.ProcessUnit = class ProcessUnit {
 
     static decode(reader, position) {
         const $ = new tflite.ProcessUnit();
-        $.options = reader.union(position, 4, tflite.ProcessUnitOptions.decode);
+        $.options = reader.union(position, 4, tflite.ProcessUnitOptions);
         return $;
     }
 
@@ -3731,15 +3731,15 @@ tflite.Stats = class Stats {
 
     static decode(reader, position) {
         const $ = new tflite.Stats();
-        $.max = reader.typedArray(position, 4, Float32Array);
-        $.min = reader.typedArray(position, 6, Float32Array);
+        $.max = reader.array(position, 4, Float32Array);
+        $.min = reader.array(position, 6, Float32Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.Stats();
-        $.max = reader.typedArray(json.max, Float32Array);
-        $.min = reader.typedArray(json.min, Float32Array);
+        $.max = reader.array(json.max, Float32Array);
+        $.min = reader.array(json.min, Float32Array);
         return $;
     }
 };
@@ -3768,10 +3768,10 @@ tflite.TensorMetadata = class TensorMetadata {
         $.name = reader.string_(position, 4, null);
         $.description = reader.string_(position, 6, null);
         $.dimension_names = reader.strings_(position, 8);
-        $.content = reader.table(position, 10, tflite.Content.decode);
-        $.process_units = reader.tableArray(position, 12, tflite.ProcessUnit.decode);
-        $.stats = reader.table(position, 14, tflite.Stats.decode);
-        $.associated_files = reader.tableArray(position, 16, tflite.AssociatedFile.decode);
+        $.content = reader.table(position, 10, tflite.Content);
+        $.process_units = reader.tables(position, 12, tflite.ProcessUnit);
+        $.stats = reader.table(position, 14, tflite.Stats);
+        $.associated_files = reader.tables(position, 16, tflite.AssociatedFile);
         return $;
     }
 
@@ -3780,10 +3780,10 @@ tflite.TensorMetadata = class TensorMetadata {
         $.name = reader.value(json.name, null);
         $.description = reader.value(json.description, null);
         $.dimension_names = reader.array(json.dimension_names);
-        $.content = reader.object(json.content, tflite.Content.decodeText);
-        $.process_units = reader.objectArray(json.process_units, tflite.ProcessUnit.decodeText);
-        $.stats = reader.object(json.stats, tflite.Stats.decodeText);
-        $.associated_files = reader.objectArray(json.associated_files, tflite.AssociatedFile.decodeText);
+        $.content = reader.object(json.content, tflite.Content);
+        $.process_units = reader.objects(json.process_units, tflite.ProcessUnit);
+        $.stats = reader.object(json.stats, tflite.Stats);
+        $.associated_files = reader.objects(json.associated_files, tflite.AssociatedFile);
         return $;
     }
 };
@@ -3793,14 +3793,14 @@ tflite.CustomMetadata = class CustomMetadata {
     static decode(reader, position) {
         const $ = new tflite.CustomMetadata();
         $.name = reader.string_(position, 4, null);
-        $.data = reader.typedArray(position, 6, Uint8Array);
+        $.data = reader.array(position, 6, Uint8Array);
         return $;
     }
 
     static decodeText(reader, json) {
         const $ = new tflite.CustomMetadata();
         $.name = reader.value(json.name, null);
-        $.data = reader.typedArray(json.data, Uint8Array);
+        $.data = reader.array(json.data, Uint8Array);
         return $;
     }
 };
@@ -3811,14 +3811,14 @@ tflite.SubGraphMetadata = class SubGraphMetadata {
         const $ = new tflite.SubGraphMetadata();
         $.name = reader.string_(position, 4, null);
         $.description = reader.string_(position, 6, null);
-        $.input_tensor_metadata = reader.tableArray(position, 8, tflite.TensorMetadata.decode);
-        $.output_tensor_metadata = reader.tableArray(position, 10, tflite.TensorMetadata.decode);
-        $.associated_files = reader.tableArray(position, 12, tflite.AssociatedFile.decode);
-        $.input_process_units = reader.tableArray(position, 14, tflite.ProcessUnit.decode);
-        $.output_process_units = reader.tableArray(position, 16, tflite.ProcessUnit.decode);
-        $.input_tensor_groups = reader.tableArray(position, 18, tflite.TensorGroup.decode);
-        $.output_tensor_groups = reader.tableArray(position, 20, tflite.TensorGroup.decode);
-        $.custom_metadata = reader.tableArray(position, 22, tflite.CustomMetadata.decode);
+        $.input_tensor_metadata = reader.tables(position, 8, tflite.TensorMetadata);
+        $.output_tensor_metadata = reader.tables(position, 10, tflite.TensorMetadata);
+        $.associated_files = reader.tables(position, 12, tflite.AssociatedFile);
+        $.input_process_units = reader.tables(position, 14, tflite.ProcessUnit);
+        $.output_process_units = reader.tables(position, 16, tflite.ProcessUnit);
+        $.input_tensor_groups = reader.tables(position, 18, tflite.TensorGroup);
+        $.output_tensor_groups = reader.tables(position, 20, tflite.TensorGroup);
+        $.custom_metadata = reader.tables(position, 22, tflite.CustomMetadata);
         return $;
     }
 
@@ -3826,14 +3826,14 @@ tflite.SubGraphMetadata = class SubGraphMetadata {
         const $ = new tflite.SubGraphMetadata();
         $.name = reader.value(json.name, null);
         $.description = reader.value(json.description, null);
-        $.input_tensor_metadata = reader.objectArray(json.input_tensor_metadata, tflite.TensorMetadata.decodeText);
-        $.output_tensor_metadata = reader.objectArray(json.output_tensor_metadata, tflite.TensorMetadata.decodeText);
-        $.associated_files = reader.objectArray(json.associated_files, tflite.AssociatedFile.decodeText);
-        $.input_process_units = reader.objectArray(json.input_process_units, tflite.ProcessUnit.decodeText);
-        $.output_process_units = reader.objectArray(json.output_process_units, tflite.ProcessUnit.decodeText);
-        $.input_tensor_groups = reader.objectArray(json.input_tensor_groups, tflite.TensorGroup.decodeText);
-        $.output_tensor_groups = reader.objectArray(json.output_tensor_groups, tflite.TensorGroup.decodeText);
-        $.custom_metadata = reader.objectArray(json.custom_metadata, tflite.CustomMetadata.decodeText);
+        $.input_tensor_metadata = reader.objects(json.input_tensor_metadata, tflite.TensorMetadata);
+        $.output_tensor_metadata = reader.objects(json.output_tensor_metadata, tflite.TensorMetadata);
+        $.associated_files = reader.objects(json.associated_files, tflite.AssociatedFile);
+        $.input_process_units = reader.objects(json.input_process_units, tflite.ProcessUnit);
+        $.output_process_units = reader.objects(json.output_process_units, tflite.ProcessUnit);
+        $.input_tensor_groups = reader.objects(json.input_tensor_groups, tflite.TensorGroup);
+        $.output_tensor_groups = reader.objects(json.output_tensor_groups, tflite.TensorGroup);
+        $.custom_metadata = reader.objects(json.custom_metadata, tflite.CustomMetadata);
         return $;
     }
 };
@@ -3857,10 +3857,10 @@ tflite.ModelMetadata = class ModelMetadata {
         $.name = reader.string_(position, 4, null);
         $.description = reader.string_(position, 6, null);
         $.version = reader.string_(position, 8, null);
-        $.subgraph_metadata = reader.tableArray(position, 10, tflite.SubGraphMetadata.decode);
+        $.subgraph_metadata = reader.tables(position, 10, tflite.SubGraphMetadata);
         $.author = reader.string_(position, 12, null);
         $.license = reader.string_(position, 14, null);
-        $.associated_files = reader.tableArray(position, 16, tflite.AssociatedFile.decode);
+        $.associated_files = reader.tables(position, 16, tflite.AssociatedFile);
         $.min_parser_version = reader.string_(position, 18, null);
         return $;
     }
@@ -3870,10 +3870,10 @@ tflite.ModelMetadata = class ModelMetadata {
         $.name = reader.value(json.name, null);
         $.description = reader.value(json.description, null);
         $.version = reader.value(json.version, null);
-        $.subgraph_metadata = reader.objectArray(json.subgraph_metadata, tflite.SubGraphMetadata.decodeText);
+        $.subgraph_metadata = reader.objects(json.subgraph_metadata, tflite.SubGraphMetadata);
         $.author = reader.value(json.author, null);
         $.license = reader.value(json.license, null);
-        $.associated_files = reader.objectArray(json.associated_files, tflite.AssociatedFile.decodeText);
+        $.associated_files = reader.objects(json.associated_files, tflite.AssociatedFile);
         $.min_parser_version = reader.value(json.min_parser_version, null);
         return $;
     }

+ 11 - 11
tools/flatc.js

@@ -997,32 +997,32 @@ flatc.Generator = class {
                                 }
                                 default: {
                                     const arrayType = `${fieldType.name[0].toUpperCase() + fieldType.name.substring(1)}Array`;
-                                    this._builder.add(`$.${field.name} = reader.typedArray(position, ${field.offset}, ${arrayType});`);
+                                    this._builder.add(`$.${field.name} = reader.array(position, ${field.offset}, ${arrayType});`);
                                     break;
                                 }
                             }
                         } else if (fieldType instanceof flatc.Union) {
                             const unionType = `${field.type.parent.name}.${field.type.name}`;
-                            this._builder.add(`$.${field.name} = reader.unionArray(position, ${field.offset}, ${unionType}.decode);`);
+                            this._builder.add(`$.${field.name} = reader.unions(position, ${field.offset}, ${unionType});`);
                         } else if (fieldType instanceof flatc.Struct) {
                             const fieldType = `${field.type.parent.name}.${field.type.name}`;
-                            this._builder.add(`$.${field.name} = reader.structArray(position, ${field.offset}, ${fieldType}.decode);`);
+                            this._builder.add(`$.${field.name} = reader.structs(position, ${field.offset}, ${fieldType});`);
                         } else {
                             const fieldType = `${field.type.parent.name}.${field.type.name}`;
-                            this._builder.add(`$.${field.name} = reader.tableArray(position, ${field.offset}, ${fieldType}.decode);`);
+                            this._builder.add(`$.${field.name} = reader.tables(position, ${field.offset}, ${fieldType});`);
                         }
                     } else if (fieldType instanceof flatc.PrimitiveType) {
                         const n = fieldType.name === 'uint64' || fieldType.name === 'int64' ? 'n' : '';
                         this._builder.add(`$.${field.name} = reader.${fieldType.name}_(position, ${field.offset}, ${field.defaultValue}${n});`);
                     } else if (fieldType instanceof flatc.Union) {
                         const unionType = `${field.type.parent.name}.${field.type.name}`;
-                        this._builder.add(`$.${field.name} = reader.union(position, ${field.offset}, ${unionType}.decode);`);
+                        this._builder.add(`$.${field.name} = reader.union(position, ${field.offset}, ${unionType});`);
                     } else if (fieldType instanceof flatc.Struct) {
                         const fieldType = `${field.type.parent.name}.${field.type.name}`;
-                        this._builder.add(`$.${field.name} = reader.struct(position, ${field.offset}, ${fieldType}.decode);`);
+                        this._builder.add(`$.${field.name} = reader.struct(position, ${field.offset}, ${fieldType});`);
                     } else {
                         const fieldType = `${field.type.parent.name}.${field.type.name}`;
-                        this._builder.add(`$.${field.name} = reader.table(position, ${field.offset}, ${fieldType}.decode);`);
+                        this._builder.add(`$.${field.name} = reader.table(position, ${field.offset}, ${fieldType});`);
                     }
                 }
                 this._builder.add('return $;');
@@ -1046,8 +1046,8 @@ flatc.Generator = class {
                                         break;
                                     }
                                     default: {
-                                        const arrayType = `${field.type.name[0].toUpperCase() + field.type.name.substring(1)}Array`;
-                                        this._builder.add(`$.${field.name} = reader.typedArray(json.${field.name}, ${arrayType});`);
+                                        const type = `${field.type.name[0].toUpperCase() + field.type.name.substring(1)}Array`;
+                                        this._builder.add(`$.${field.name} = reader.array(json.${field.name}, ${type});`);
                                         break;
                                     }
                                 }
@@ -1058,7 +1058,7 @@ flatc.Generator = class {
                                 this._builder.add(`$.${field.name} = ${fieldType}.decode(reader, position + ${field.offset});`);
                             } else {
                                 const fieldType = `${field.type.parent.name}.${field.type.name}`;
-                                this._builder.add(`$.${field.name} = reader.objectArray(json.${field.name}, ${fieldType}.decodeText);`);
+                                this._builder.add(`$.${field.name} = reader.objects(json.${field.name}, ${fieldType});`);
                             }
                         } else if (field.type instanceof flatc.PrimitiveType) {
                             switch (field.type.name) {
@@ -1083,7 +1083,7 @@ flatc.Generator = class {
                             this._builder.add(`$.${field.name} = ${unionType}.decodeText(reader, json.${field.name}, json.${field.name}_type);`);
                         } else { // struct | table
                             const fieldType = `${field.type.parent.name}.${field.type.name}`;
-                            this._builder.add(`$.${field.name} = reader.object(json.${field.name}, ${fieldType}.decodeText);`);
+                            this._builder.add(`$.${field.name} = reader.object(json.${field.name}, ${fieldType});`);
                         }
                     }
                     this._builder.add('return $;');

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików