| 2866 | }; |
| 2867 | |
| 2868 | struct TensorBuilder { |
| 2869 | flatbuffers::FlatBufferBuilder &fbb_; |
| 2870 | flatbuffers::uoffset_t start_; |
| 2871 | void add_shape(flatbuffers::Offset<flatbuffers::Vector<int32_t>> shape) { |
| 2872 | fbb_.AddOffset(Tensor::VT_SHAPE, shape); |
| 2873 | } |
| 2874 | void add_type(TensorType type) { |
| 2875 | fbb_.AddElement<int8_t>(Tensor::VT_TYPE, static_cast<int8_t>(type), 0); |
| 2876 | } |
| 2877 | void add_buffer(uint32_t buffer) { |
| 2878 | fbb_.AddElement<uint32_t>(Tensor::VT_BUFFER, buffer, 0); |
| 2879 | } |
| 2880 | void add_name(flatbuffers::Offset<flatbuffers::String> name) { |
| 2881 | fbb_.AddOffset(Tensor::VT_NAME, name); |
| 2882 | } |
| 2883 | void add_quantization(flatbuffers::Offset<QuantizationParameters> quantization) { |
| 2884 | fbb_.AddOffset(Tensor::VT_QUANTIZATION, quantization); |
| 2885 | } |
| 2886 | void add_is_variable(bool is_variable) { |
| 2887 | fbb_.AddElement<uint8_t>(Tensor::VT_IS_VARIABLE, static_cast<uint8_t>(is_variable), 0); |
| 2888 | } |
| 2889 | explicit TensorBuilder(flatbuffers::FlatBufferBuilder &_fbb) |
| 2890 | : fbb_(_fbb) { |
| 2891 | start_ = fbb_.StartTable(); |
| 2892 | } |
| 2893 | TensorBuilder &operator=(const TensorBuilder &); |
| 2894 | flatbuffers::Offset<Tensor> Finish() { |
| 2895 | const auto end = fbb_.EndTable(start_); |
| 2896 | auto o = flatbuffers::Offset<Tensor>(end); |
| 2897 | return o; |
| 2898 | } |
| 2899 | }; |
| 2900 | |
| 2901 | inline flatbuffers::Offset<Tensor> CreateTensor( |
| 2902 | flatbuffers::FlatBufferBuilder &_fbb, |
no outgoing calls
no test coverage detected