Skip to content

Commit

Permalink
[layers] Import arraysEqual from the public import path (#7959)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsoulanille authored Sep 18, 2023
1 parent 0bd03f7 commit ec1b574
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tfjs-layers/src/layers/nlp/multihead_attention.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
*/

/* Original source: keras/layers/attention/multi_head_attention.py */
import { Tensor, einsum, linalg, logicalAnd, mul, ones, serialization, tidy } from '@tensorflow/tfjs-core';
// tslint:disable-next-line: no-imports-from-dist
import { arraysEqual } from '@tensorflow/tfjs-core/dist/util_base';
import { Tensor, einsum, linalg, logicalAnd, mul, ones, serialization, tidy, util } from '@tensorflow/tfjs-core';

import { cast, expandDims } from '../../backend/tfjs_backend';
import { Constraint, ConstraintIdentifier, getConstraint, serializeConstraint } from '../../constraints';
Expand Down Expand Up @@ -882,7 +880,7 @@ export class MultiHeadAttention extends Layer {
);
}

if (!arraysEqual(valueShape.slice(1, -1), keyShape.slice(1, -1))) {
if (!util.arraysEqual(valueShape.slice(1, -1), keyShape.slice(1, -1))) {
throw new Error(
`All dimensions of 'value' and 'key', except the last one, must be ` +
`equal. Received ${valueShape} and ${keyShape}`
Expand Down

0 comments on commit ec1b574

Please sign in to comment.