Lines Matching full:matrix
45 // Simple representation of a matrix. This small struct that doesn't own any
47 struct Matrix { struct
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 { in GetEmbeddingMatrix() argument
80 Matrix matrix; in GetEmbeddingMatrix() local
81 matrix.rows = embeddings_num_rows(i); in GetEmbeddingMatrix()
82 matrix.cols = embeddings_num_cols(i); in GetEmbeddingMatrix()
83 matrix.elements = embeddings_weights(i); in GetEmbeddingMatrix()
84 matrix.quant_type = embeddings_quant_type(i); in GetEmbeddingMatrix()
85 matrix.quant_scales = embeddings_quant_scales(i); in GetEmbeddingMatrix()
86 return matrix; in GetEmbeddingMatrix()
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 { in GetHiddenLayerMatrix()
114 Matrix matrix; in GetHiddenLayerMatrix() local
115 matrix.rows = hidden_num_rows(i); in GetHiddenLayerMatrix()
116 matrix.cols = hidden_num_cols(i); in GetHiddenLayerMatrix()
119 matrix.quant_type = QuantizationType::NONE; in GetHiddenLayerMatrix()
120 matrix.elements = hidden_weights(i); in GetHiddenLayerMatrix()
121 return matrix; in GetHiddenLayerMatrix()
124 // Returns bias matrix for i-th hidden layer. Technically a Matrix, but we
129 Matrix GetHiddenLayerBias(int i) const { in GetHiddenLayerBias()
131 Matrix matrix; in GetHiddenLayerBias() local
132 matrix.rows = hidden_bias_num_rows(i); in GetHiddenLayerBias()
133 matrix.cols = hidden_bias_num_cols(i); in GetHiddenLayerBias()
136 matrix.quant_type = QuantizationType::NONE; in GetHiddenLayerBias()
137 matrix.elements = hidden_bias_weights(i); in GetHiddenLayerBias()
138 return matrix; in GetHiddenLayerBias()
150 // Returns weight matrix for the softmax layer.
154 Matrix GetSoftmaxMatrix() const { in GetSoftmaxMatrix()
156 Matrix matrix; in GetSoftmaxMatrix() local
157 matrix.rows = softmax_num_rows(0); in GetSoftmaxMatrix()
158 matrix.cols = softmax_num_cols(0); in GetSoftmaxMatrix()
161 matrix.quant_type = QuantizationType::NONE; in GetSoftmaxMatrix()
162 matrix.elements = softmax_weights(0); in GetSoftmaxMatrix()
163 return matrix; in GetSoftmaxMatrix()
166 // Returns bias for the softmax layer. Technically a Matrix, but we expect it
171 Matrix GetSoftmaxBias() const { in GetSoftmaxBias()
173 Matrix matrix; in GetSoftmaxBias() local
174 matrix.rows = softmax_bias_num_rows(0); in GetSoftmaxBias()
175 matrix.cols = softmax_bias_num_cols(0); in GetSoftmaxBias()
178 matrix.quant_type = QuantizationType::NONE; in GetSoftmaxBias()
179 matrix.elements = softmax_bias_weights(0); in GetSoftmaxBias()
180 return matrix; in GetSoftmaxBias()
216 // * "transpose(M)" denotes the transpose of a matrix M.