-
Notifications
You must be signed in to change notification settings - Fork 2k
Remove cpu backend in tfjs-node testing, use fake instead. #3082
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
Conversation
tafsiri
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lina128 Is that the only test in node backend that uses CPU?
I think this test should be changed as none of its behaviour depends on the CPU backend specifically. Rather than use the CPU backend it should create a mock backend and set it and run its test.
See engine_test for examples of this. kernel_registry_test also does uses the same approach.
Reviewable status: 0 of 1 approvals obtained (waiting on @kangyizhang, @pyu10055, and @tafsiri)
lina128
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Done.
Reviewable status: 0 of 1 approvals obtained (waiting on @kangyizhang and @pyu10055)
tafsiri
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 3 files at r1.
Reviewable status:complete! 1 of 1 approvals obtained (waiting on @kangyizhang, @lina128, @pyu10055, and @tafsiri)
tfjs-node/src/image_test.ts, line 227 at r1 (raw file):
try { const testBackend = new TestKernelBackend(); registerBackend('sync', () => testBackend);
nit: rename this to something else (e.g. 'testBackend'). the sync nature of it isn't particularly relevant here.
tfjs-node/src/nodejs_kernel_backend_test.ts, line 82 at r1 (raw file):
const testBackend = new TestKernelBackend(); tf.registerBackend('sync', () => testBackend); tf.setBackend('sync');
nit: same as above.
lina128
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 1 of 1 approvals obtained (waiting on @kangyizhang and @pyu10055)
tfjs-node/src/image_test.ts, line 227 at r1 (raw file):
Previously, tafsiri (Yannick Assogba) wrote…
nit: rename this to something else (e.g. 'testBackend'). the sync nature of it isn't particularly relevant here.
Done.
tfjs-node/src/nodejs_kernel_backend_test.ts, line 82 at r1 (raw file):
Previously, tafsiri (Yannick Assogba) wrote…
nit: same as above.
Done.
Node test use cpu backend: https://github.com/tensorflow/tfjs/blob/master/tfjs-node/src/image_test.ts#L224
The test total was 3738, comparing to 3724 after. The 14 tests belong to array_util_test and complex_util_test in backends, which is not backend agnostic and thus excluded from tests.ts. This is expected.
This change is