From e9301219f22cf1f69164390a688a875166618742 Mon Sep 17 00:00:00 2001 From: Reilly Grant Date: Thu, 25 Jul 2024 17:56:44 -0700 Subject: [PATCH] Remove platform-specific layout selection code The TFLike backend in Chromium supports either input layout. This heuristic for detecting whether or not this backend is being used can be removed as it now hinders testing. --- common/utils.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/common/utils.js b/common/utils.js index c918d105..47787043 100644 --- a/common/utils.js +++ b/common/utils.js @@ -518,18 +518,11 @@ export function permuteData(array, dims, axes) { } export function getDefaultLayout(deviceType) { - const userAgent = navigator.userAgent; - if (userAgent.indexOf('Linux') != -1 || userAgent.indexOf('Android') != -1 || - userAgent.indexOf('CrOS') != -1) { + if (deviceType.indexOf('cpu') != -1) { return 'nhwc'; - } else { - // Windows or Mac platform. - if (deviceType.indexOf('cpu') != -1) { - return 'nhwc'; - } else if (deviceType.indexOf('gpu') != -1 || - deviceType.indexOf('npu') != -1) { - return 'nchw'; - } + } else if (deviceType.indexOf('gpu') != -1 || + deviceType.indexOf('npu') != -1) { + return 'nchw'; } }