| 50 | |
| 51 | struct BERTLayer { |
| 52 | explicit BERTLayer(NPZLoader params, int64_t n_heads) { |
| 53 | // define layer network here |
| 54 | attention_.reset(new layers::BertAttention( |
| 55 | params["attention.qkv.weight"], params["attention.qkv.bias"], |
| 56 | params["attention.output.dense.weight"], |
| 57 | params["attention.output.dense.bias"], |
| 58 | params["attention.output.LayerNorm.weight"], |
| 59 | params["attention.output.LayerNorm.bias"], n_heads)); |
| 60 | intermediate_.reset( |
| 61 | new layers::BertIntermediate(params["intermediate.dense.weight"], |
| 62 | params["intermediate.dense.bias"])); |
| 63 | output_.reset(new layers::BertOutput( |
| 64 | params["output.dense.weight"], params["output.dense.bias"], |
| 65 | params["output.LayerNorm.weight"], params["output.LayerNorm.bias"])); |
| 66 | } |
| 67 | |
| 68 | void operator()(core::Tensor &hidden, core::Tensor &mask, |
| 69 | core::Tensor *attention_out, core::Tensor *intermediate_out, |
nothing calls this directly
no outgoing calls
no test coverage detected