Skip to content

Commit

Permalink
Added back the assumption comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
satyajandhyala committed Aug 17, 2024
1 parent c8b187f commit d0b0627
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions js/web/lib/wasm/jsep/webgpu/ops/attention.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d0b0627

Please sign in to comment.