Skip to content

Commit

Permalink
Remove platform-specific layout selection code (#265)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
reillyeon authored Aug 5, 2024
1 parent 2b63a95 commit e73fe77
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions common/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}

Expand Down

0 comments on commit e73fe77

Please sign in to comment.