| 56 | } |
| 57 | |
| 58 | bool checkArrayShape(const mx::array &Arr) { |
| 59 | auto Shape = Arr.shape(); |
| 60 | if (Shape.size() != 4) |
| 61 | return false; |
| 62 | int OutChannels = Shape[0]; |
| 63 | int KH = Shape[1]; |
| 64 | int KW = Shape[2]; |
| 65 | return (OutChannels >= KH) && (OutChannels >= KW) && (KH == KW); |
| 66 | } |
| 67 | |
| 68 | VisionAttention::VisionAttention(int Dims, int NumHeads, |
| 69 | std::optional<int> QueryInputDims, |