Title: Java API DataBuffers.of uses buffer incorrectly · Issue #9 · tensorflow/java-ndarray · GitHub
Open Graph Title: Java API DataBuffers.of uses buffer incorrectly · Issue #9 · tensorflow/java-ndarray
X Title: Java API DataBuffers.of uses buffer incorrectly · Issue #9 · tensorflow/java-ndarray
Description: Hi, I am seeing this behavior when creating a Tensor using a buffer that is created by wrapping an array. The example below can reproduce the issue: // create an buffer by wrapping an array but buffer start from position 3 and length is ...
Open Graph Description: Hi, I am seeing this behavior when creating a Tensor using a buffer that is created by wrapping an array. The example below can reproduce the issue: // create an buffer by wrapping an array but buf...
X Description: Hi, I am seeing this behavior when creating a Tensor using a buffer that is created by wrapping an array. The example below can reproduce the issue: // create an buffer by wrapping an array but buf...
Opengraph URL: https://github.com/tensorflow/java-ndarray/issues/9
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Java API DataBuffers.of uses buffer incorrectly","articleBody":"Hi, \r\n\r\nI am seeing this behavior when creating a Tensor using a buffer that is created by wrapping an array. \r\nThe example below can reproduce the issue:\r\n\r\n```\r\n// create an buffer by wrapping an array but buffer start from position 3 and length is 4\r\nfinal IntBuffer src = IntBuffer.wrap(new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8}, 3, 4).asReadOnlyBuffer();\r\nfinal org.tensorflow.Tensor tensor = TInt32.tensorOf(Shape.of(4), DataBuffers.of(src));\r\n\r\nfinal int[] value = new int[4];\r\ntensor.asRawTensor().data().asInts().read(value);\r\nassertArrayEquals(new int[]{0, 1, 2, 3}, value); // This is not really a correct behavior, it is not honoring the buffer offset when wrapping the array, it just takes the first 4 elements\r\n//assertArrayEquals(new int[]{3, 4, 5, 6}, value); // This should be the desired result\r\n```\r\n\r\nSystem info:\r\nJava `8`\r\ntensorflow-java (tensorflow-core-api) `0.4.1`","author":{"url":"https://github.com/fyang996","@type":"Person","name":"fyang996"},"datePublished":"2022-08-31T23:48:19.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/9/java-ndarray/issues/9"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5f4a3bf9-ff8e-74e5-60e1-cbbcf8735851 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A4F4:12F3EF:27DBE7:37D035:697241EC |
| html-safe-nonce | cb5703e11d0f579f0d30b13ccd211f921d5842e15a40ba213a4844c21adb900d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNEY0OjEyRjNFRjoyN0RCRTc6MzdEMDM1OjY5NzI0MUVDIiwidmlzaXRvcl9pZCI6IjM1OTc2MzUxMDE5MjA0Nzc2NzYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 30d68da6b9ec734a2ae401c5ecc96a70ba4f20b8965c02ebddcb4103a4893bb5 |
| hovercard-subject-tag | issue:1360681241 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/tensorflow/java-ndarray/9/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cd4ef0d05702faf9c283648a7bb76d0ce73e026205de34264c40d3aa1a676ede/tensorflow/java-ndarray/issues/9 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cd4ef0d05702faf9c283648a7bb76d0ce73e026205de34264c40d3aa1a676ede/tensorflow/java-ndarray/issues/9 |
| og:image:alt | Hi, I am seeing this behavior when creating a Tensor using a buffer that is created by wrapping an array. The example below can reproduce the issue: // create an buffer by wrapping an array but buf... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | fyang996 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2c16db4e575031f6e3be03e0437c1ab663e0b4643ba5cbbfba48c1e4fc056a11 |
| turbo-cache-control | no-preview |
| go-import | github.com/tensorflow/java-ndarray git https://github.com/tensorflow/java-ndarray.git |
| octolytics-dimension-user_id | 15658638 |
| octolytics-dimension-user_login | tensorflow |
| octolytics-dimension-repository_id | 349488998 |
| octolytics-dimension-repository_nwo | tensorflow/java-ndarray |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 349488998 |
| octolytics-dimension-repository_network_root_nwo | tensorflow/java-ndarray |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 584fea6daacd0ba6f8dbec869937910ee0ae2e64 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width