From d0b0627b33602123ff009d2c006993e942a6a036 Mon Sep 17 00:00:00 2001 From: Satya Jandhyala Date: Sat, 17 Aug 2024 13:08:13 -0700 Subject: [PATCH] Added back the assumption comment. --- js/web/lib/wasm/jsep/webgpu/ops/attention.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/js/web/lib/wasm/jsep/webgpu/ops/attention.ts b/js/web/lib/wasm/jsep/webgpu/ops/attention.ts index 924f2f4067302..a3f2be134fb29 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/attention.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/attention.ts @@ -675,6 +675,7 @@ export const applyAttention = ( parameters: AttentionParameters, attributes: AttentionAttrs, ) => { + // Assumption is that presentKey/presentValue exists only if pastKey/pastValue exists. const outputCount = Math.min(context.outputCount, 1 + (pastKey ? 1 : 0) + (pastValue ? 1 : 0)); const pastSequenceLength = parameters.kvNumHeads !== undefined || outputCount > 1 ? parameters.pastSequenceLength : 0; const totalSequenceLength = pastSequenceLength + parameters.kvSequenceLength;