File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
tensorflow-core/tensorflow-core-api/src
main/java/org/tensorflow/internal/buffer
test/java/org/tensorflow/types Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,8 @@ public byte[] getObject(long index) {
105105 int length = 0 ;
106106 do {
107107 b = data .getByte (offset ++);
108- length |= (b & 0x7F ) << pos ++;
108+ length |= (b & 0x7F ) << pos ;
109+ pos += 7 ;
109110 } while ((b & 0x80 ) != 0 );
110111
111112 // Read string of the given length
Original file line number Diff line number Diff line change @@ -41,7 +41,19 @@ public void createScalar() {
4141 assertEquals ("Pretty vacant" , data .getObject ());
4242 }
4343
44- @ Test
44+ @ Test
45+ public void createrScalarLongerThan127 () {
46+ Tensor <TString > tensor = TString .scalarOf ("Long String 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 !" );
47+ assertNotNull (tensor );
48+
49+ TString data = tensor .data ();
50+ assertNotNull (data );
51+ assertEquals (Shape .scalar (), data .shape ());
52+ assertEquals ("Long String 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 !" , data .getObject ());
53+ }
54+
55+
56+ @ Test
4557 public void createVector () {
4658 Tensor <TString > tensor = TString .vectorOf ("Pretty" , "vacant" );
4759 assertNotNull (tensor );
You can’t perform that action at this time.
0 commit comments