Skip to content

Commit 929b35d

Browse files
Fix webgpu support check failing if globalThis is undefined (#8073)
Fix WebGPU support not working on iOS, where globalThis is sometimes not available.
1 parent 5ad2606 commit 929b35d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tfjs-backend-webgpu/src/webgpu_util.ts

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

157157
export function isWebGPUSupported(): boolean {
158-
return !!(globalThis && (globalThis.navigator) && (globalThis.navigator.gpu));
158+
return !!(typeof globalThis !== 'undefined' && (globalThis.navigator)
159+
&& (globalThis.navigator.gpu));
159160
}
160161

161162
export function assertNotComplex(

0 commit comments

Comments
 (0)