From 5c0b54002c777b47aaf86acb92ea516109d85788 Mon Sep 17 00:00:00 2001 From: Xu Xing Date: Wed, 31 Jan 2024 08:54:28 +0800 Subject: [PATCH] Lint --- .../jsep/webgpu/ops/3rd-party/matmul_packed_webgpu.ts | 2 +- js/web/lib/wasm/jsep/webgpu/ops/conv-grouped.ts | 8 +------- js/web/lib/wasm/jsep/webgpu/ops/fuse-utils.ts | 7 +++++-- js/web/lib/wasm/jsep/webgpu/ops/matmul.ts | 8 -------- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/matmul_packed_webgpu.ts b/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/matmul_packed_webgpu.ts index 4518f4d780c6d..d9a8d59f731de 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/matmul_packed_webgpu.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/matmul_packed_webgpu.ts @@ -409,7 +409,7 @@ const matMulReadWriteFnSource = ${ hasBias ? `value = value + ${isChannelsLast ? 'bias[colIn]' : `${typeSnippet(component, dataType)}(bias[row])`};` : - ''} + '' } ${applyActivation} ${outputVariable.setByIndices('vec3(coords)', 'value')} } diff --git a/js/web/lib/wasm/jsep/webgpu/ops/conv-grouped.ts b/js/web/lib/wasm/jsep/webgpu/ops/conv-grouped.ts index 65a4c1633e107..3c2c3cc4e046c 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/conv-grouped.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/conv-grouped.ts @@ -34,13 +34,7 @@ export const createGroupedConvProgramInfo = {type: DataType.uint32, data: [attributes.pads[0], attributes.pads[1]]}, {type: DataType.uint32, data: outputChannelsPerGroup} ]; -<<<<<<< HEAD - if (attributes.activation === 'Clip') { - programUniforms.push( - {type: DataType.float, data: attributes.clipMax!}, {type: DataType.float, data: attributes.clipMin!}); - } - == == === appendActivationUniformsData(attributes, programUniforms); ->>>>>>> main + appendActivationUniformsData(attributes, programUniforms); programUniforms.push( ...createTensorShapeVariables(xShape), ...createTensorShapeVariables(wShape), ...createTensorShapeVariables(outputShape)); diff --git a/js/web/lib/wasm/jsep/webgpu/ops/fuse-utils.ts b/js/web/lib/wasm/jsep/webgpu/ops/fuse-utils.ts index e1dc9a5e0ab7d..60067c014613b 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/fuse-utils.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/fuse-utils.ts @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +import {DataType} from '../../../wasm-common'; import {MAX_CLIP, MIN_CLIP} from '../../util'; import {ProgramUniform} from '../types'; @@ -36,9 +37,11 @@ export const getActivationSnippet = (attributes: InternalActivationAttributes, v export const appendActivationUniformsData = (attributes: InternalActivationAttributes, programUniform: ProgramUniform[]) => { if (attributes.activation === 'Clip') { - programUniform.push({type: 'float32', data: attributes.clipMax!}, {type: 'float32', data: attributes.clipMin!}); + programUniform.push( + {type: DataType.float, data: attributes.clipMax!}, {type: DataType.float, data: attributes.clipMin!}); } else if (attributes.activation === 'HardSigmoid') { - programUniform.push({type: 'float32', data: attributes.alpha!}, {type: 'float32', data: attributes.beta!}); + programUniform.push( + {type: DataType.float, data: attributes.alpha!}, {type: DataType.float, data: attributes.beta!}); } }; diff --git a/js/web/lib/wasm/jsep/webgpu/ops/matmul.ts b/js/web/lib/wasm/jsep/webgpu/ops/matmul.ts index a9c6431a15a78..b263451b99134 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/matmul.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/matmul.ts @@ -33,15 +33,7 @@ export const createNaiveMatmulProgramInfo = {type: DataType.uint32, data: outputSize}, {type: DataType.uint32, data: M}, {type: DataType.uint32, data: N}, {type: DataType.uint32, data: K} ]; -<<<<<<< HEAD - if (activationAttributes.activation === 'Clip') { - programUniforms.push( - {type: DataType.float, data: activationAttributes.clipMax!}, - {type: DataType.float, data: activationAttributes.clipMin!}); - } -======= appendActivationUniformsData(activationAttributes, programUniforms); ->>>>>>> main programUniforms.push( ...createTensorShapeVariables(outerDims), ...createTensorShapeVariables(aShape), ...createTensorShapeVariables(bShape));