From e73fe77b7aa7f839f05a6dad85f1476dd845f237 Mon Sep 17 00:00:00 2001 From: Reilly Grant Date: Sun, 4 Aug 2024 18:29:40 -0700 Subject: [PATCH] Remove platform-specific layout selection code (#265) 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'; } }