Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why parseGrayscaleImageData and parseRGBImageData of xhrdataset have the same function? #68

Closed
dsmilkov opened this issue Apr 2, 2018 · 5 comments

Comments

@dsmilkov
Copy link
Contributor

dsmilkov commented Apr 2, 2018

From @cyilu on March 27, 2018 6:41

I think these two function are alike:
`
function parseGrayscaleImageData(
data: Uint8Array|Uint8ClampedArray, result: Uint8Array,
resultOffset: number): void {
let idx = resultOffset;
for (let i = 0; i < data.length; i += 4) {
result[idx++] = data[i];
}
}

function parseRGBImageData(
data: Uint8Array|Uint8ClampedArray, result: Uint8Array,
resultOffset: number): void {
let idx = resultOffset;
for (let i = 0; i < data.length; i += 4) {
result[idx] = data[i];
result[idx + 1] = data[i + 1];
result[idx + 2] = data[i + 2];
idx += 3;
}
}`

Copied from original issue: tensorflow/tfjs-core#902

@dsmilkov
Copy link
Contributor Author

dsmilkov commented Apr 2, 2018

From @nsthorat on March 27, 2018 14:10

The functions are slightly different, one is parsing a grayscale image (just parsing red channel), and the other is parsing the fully packed RGB byte array. Notice the inner for loop is different.

@dsmilkov
Copy link
Contributor Author

dsmilkov commented Apr 2, 2018

From @cyilu on March 28, 2018 6:13

@nsthorat But the "data" is 1d array. Therefore, "data" to "result" is 1d array to 1d array. Isn't it?

@dsmilkov
Copy link
Contributor Author

dsmilkov commented Apr 2, 2018

From @nsthorat on March 28, 2018 15:29

ImageData is always a flat array, you can check out the docs here: https://developer.mozilla.org/en-US/docs/Web/API/ImageData

@dsmilkov
Copy link
Contributor Author

dsmilkov commented Apr 2, 2018

From @cyilu on March 29, 2018 2:32

@nsthorat Yes, I think these tow function all transfer a flat array to a flat array.

@dsmilkov
Copy link
Contributor Author

dsmilkov commented Apr 2, 2018

Hi closing this issue since there is an answer posted already. Feel free to reopen if you have additional questions regarding this thread.

@dsmilkov dsmilkov closed this as completed Apr 2, 2018
nsthorat pushed a commit that referenced this issue Aug 19, 2019
**NOTE: This change depends on tensorflow/tfjs-core#926 being submitted first.**

- Made `tfjs-node` depend on `tfjs-core` at master, instead of a version number. This makes us move faster without the need to publish new npm versions.

- Added `src/run_tests.ts` which calls jasmine programatically and runs 1) the tests in this repo and 2) ~1600 tests from core. All tests run against the tensorflow backend.

- About 400 tests from core fail, so I added an `IGNORE_LIST` in `run_tests.ts`, to skip the tests that fail. As we fix these, we remove them from the list.

- Fixed a bug with the nodejs backend, where disposal of tensor that hasn't been yet uploaded to the C world, was resulting in an exception.
nsthorat pushed a commit that referenced this issue Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant