Commit 756be76
committed
Fix flexbuffers vector creation bug in MLIR TFLite export
---
When exporting StableHLOComposite attributes, flexbuffers::Builder was being called with the attribute name as a key for every vector element. In flexbuffers, passing a key to a Vector element pushes both the key and the value to the stack, causing the vector to be parsed with twice its intended length (with the key interleaved).
This change removes the key from the vector element calls, and only uses the key when starting the parent vector, which matches the flexbuffers::Builder API expectation for Vectors.
- Also fixed a typo where `isa<StringAttr>(attr)` was checking the Array attribute instead of the element.
- Updated test to pass actual vector values for serialization
PiperOrigin-RevId: 9411771311 parent 482a036 commit 756be76
2 files changed
Lines changed: 13 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1904 | 1904 | | |
1905 | 1905 | | |
1906 | 1906 | | |
1907 | | - | |
1908 | | - | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
1909 | 1911 | | |
1910 | 1912 | | |
1911 | 1913 | | |
1912 | 1914 | | |
1913 | | - | |
1914 | | - | |
1915 | | - | |
| 1915 | + | |
| 1916 | + | |
1916 | 1917 | | |
1917 | | - | |
1918 | 1918 | | |
1919 | 1919 | | |
1920 | 1920 | | |
1921 | | - | |
1922 | 1921 | | |
1923 | 1922 | | |
1924 | 1923 | | |
1925 | | - | |
1926 | 1924 | | |
1927 | 1925 | | |
1928 | | - | |
1929 | | - | |
| 1926 | + | |
1930 | 1927 | | |
1931 | 1928 | | |
1932 | 1929 | | |
1933 | | - | |
1934 | | - | |
| 1930 | + | |
1935 | 1931 | | |
1936 | 1932 | | |
1937 | 1933 | | |
1938 | 1934 | | |
1939 | | - | |
| 1935 | + | |
1940 | 1936 | | |
1941 | 1937 | | |
1942 | 1938 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | | - | |
298 | | - | |
| 297 | + | |
| 298 | + | |
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| |||
0 commit comments