Home | History | Annotate | Download | only in common

Lines Matching refs:Matrix

45   // Simple representation of a matrix.  This small struct that doesn't own any
47 struct Matrix {
56 // Pointer to matrix elements, in row-major order
74 // Returns embedding matrix for the i-th embedding space.
78 Matrix GetEmbeddingMatrix(int i) const {
80 Matrix matrix;
81 matrix.rows = embeddings_num_rows(i);
82 matrix.cols = embeddings_num_cols(i);
83 matrix.elements = embeddings_weights(i);
84 matrix.quant_type = embeddings_quant_type(i);
85 matrix.quant_scales = embeddings_quant_scales(i);
86 return matrix;
99 // weight matrix and a bias vector (a matrix with one column).
108 // Returns weight matrix for i-th hidden layer.
112 Matrix GetHiddenLayerMatrix(int i) const {
114 Matrix matrix;
115 matrix.rows = hidden_num_rows(i);
116 matrix.cols = hidden_num_cols(i);
119 matrix.quant_type = QuantizationType::NONE;
120 matrix.elements = hidden_weights(i);
121 return matrix;
124 // Returns bias matrix for i-th hidden layer. Technically a Matrix, but we
129 Matrix GetHiddenLayerBias(int i) const {
131 Matrix matrix;
132 matrix.rows = hidden_bias_num_rows(i);
133 matrix.cols = hidden_bias_num_cols(i);
136 matrix.quant_type = QuantizationType::NONE;
137 matrix.elements = hidden_bias_weights(i);
138 return matrix;
150 // Returns weight matrix for the softmax layer.
154 Matrix GetSoftmaxMatrix() const {
156 Matrix matrix;
157 matrix.rows = softmax_num_rows(0);
158 matrix.cols = softmax_num_cols(0);
161 matrix.quant_type = QuantizationType::NONE;
162 matrix.elements = softmax_weights(0);
163 return matrix;
166 // Returns bias for the softmax layer. Technically a Matrix, but we expect it
171 Matrix GetSoftmaxBias() const {
173 Matrix matrix;
174 matrix.rows = softmax_bias_num_rows(0);
175 matrix.cols = softmax_bias_num_cols(0);
178 matrix.quant_type = QuantizationType::NONE;
179 matrix.elements = softmax_bias_weights(0);
180 return matrix;
216 // * "transpose(M)" denotes the transpose of a matrix M.