TinyChatEngine
Loading...
Searching...
No Matches
llm
include
nn_modules
Fp32CLIPEncoder.h
1
#include <cstdlib>
2
#include <string>
3
#include <vector>
4
5
#include "Fp32CLIPEncoderLayer.h"
6
#include "common.h"
7
#include "operators.h"
8
9
struct
Fp32CLIPEncoder_output
{
10
Matrix3D<float>
last_hidden_state;
11
std::vector<Matrix3D<float>> past_keys, past_values;
12
};
13
struct
Fp32CLIPEncoder_input
{
14
Matrix3D<float>
hidden_states;
15
Matrix3D<float>
attention_mask;
16
std::vector<Matrix3D<float>> past_keys, past_values;
17
bool
has_past_keys_values;
18
19
Fp32CLIPEncoder_input
(
Matrix3D<float>
hidden_states_,
Matrix3D<float>
attention_mask_)
20
: hidden_states(hidden_states_), attention_mask(attention_mask_) {
21
has_past_keys_values =
false
;
22
}
23
Fp32CLIPEncoder_input
(
Matrix3D<float>
hidden_states_,
Matrix3D<float>
attention_mask_,
24
std::vector<
Matrix3D<float>
> past_keys_, std::vector<
Matrix3D<float>
> past_values_)
25
: hidden_states(hidden_states_), attention_mask(attention_mask_), past_keys(past_keys_), past_values(past_values_) {
26
has_past_keys_values =
true
;
27
}
28
};
29
30
class
Fp32CLIPEncoder
{
31
public
:
32
Fp32CLIPEncoder
(std::string param_path,
const
struct
model_config
config);
33
Fp32CLIPEncoder
(){};
34
struct
Fp32CLIPEncoder_output
forward(const struct
Fp32CLIPEncoder_input
& input);
35
std::vector<Fp32CLIPEncoderLayer> layers;
36
std::string profile_name =
"Fp32CLIPEncoder"
;
37
};
Fp32CLIPEncoder
Definition
Fp32CLIPEncoder.h:30
Matrix3D
Definition
common.h:34
Fp32CLIPEncoder_input
Definition
Fp32CLIPEncoder.h:13
Fp32CLIPEncoder_output
Definition
Fp32CLIPEncoder.h:9
model_config
Definition
model.h:5
Generated by
1.11.0