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
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) {
105
105
int length = 0 ;
106
106
do {
107
107
b = data .getByte (offset ++);
108
- length |= (b & 0x7F ) << pos ++;
108
+ length |= (b & 0x7F ) << pos ;
109
+ pos += 7 ;
109
110
} while ((b & 0x80 ) != 0 );
110
111
111
112
// Read string of the given length
Original file line number Diff line number Diff line change @@ -41,7 +41,19 @@ public void createScalar() {
41
41
assertEquals ("Pretty vacant" , data .getObject ());
42
42
}
43
43
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
45
57
public void createVector () {
46
58
Tensor <TString > tensor = TString .vectorOf ("Pretty" , "vacant" );
47
59
assertNotNull (tensor );
You can’t perform that action at this time.
0 commit comments