TinyChatEngine
Loading...
Searching...
No Matches
RotaryPosEmb.h
1#include <cstdlib>
2
3#include "common.h"
4#include "utils.h"
5
7 public:
8 RotaryPosEmb(Matrix3D<float> _cos, Matrix3D<float> _sin, std::string path) {
9 sin = _sin;
10 cos = _cos;
11 read_to_array((path + "/cos_cached.bin").c_str(), cos.m_data, cos.length());
12 read_to_array((path + "/sin_cached.bin").c_str(), sin.m_data, sin.length());
13 };
14 RotaryPosEmb(){};
15 void forward(Matrix3D<float> &key, Matrix3D<float> &value, int start_idx, int len);
16 Matrix3D<float> cos, sin;
17
18 private:
19 std::string profile_name = "RotaryPosEmb";
20};
21
22void load_RotaryPosEmb(RotaryPosEmb &op, std::string prefix);
Definition common.h:34
Definition RotaryPosEmb.h:6