Skip to content

Commit 0e50e74

Browse files
Fix isWebGPUSupported throwing an error in node (#8070)
BUG While node is not supported, 'isWebGPUSupported' should return false instead of throwing an error. This fixes pose-detection node tests, which use the same files as the browser tests.
1 parent 7270e44 commit 0e50e74

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tfjs-backend-webgpu/src/webgpu_util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export function GPUBytesPerElement(dtype: DataType): number {
155155
}
156156

157157
export function isWebGPUSupported(): boolean {
158-
return !!globalThis.navigator.gpu;
158+
return !!(globalThis && (globalThis.navigator) && (globalThis.navigator.gpu));
159159
}
160160

161161
export function assertNotComplex(

0 commit comments

Comments
 (0)