def filter(self): """Gets the filters. The dimensions: - BatchLength * BatchWidth * ListSize is filter_count - Height, Width, Depth are taken from filter_size - Channels is equal to the inputs' Channels """ return Blob(self._internal.get_filter())
def weights(self): """Gets the trained weights as a blob of the dimensions: - **BatchLength** * **BatchWidth** * **ListSize** equal to element_count - **Height**, **Width**, **Depth**, **Channels** the same as for the first input """ return Blob.Blob(self._internal.get_weights())
def get_embeddings(self, index): """Gets the representation table with the given index as a blob of the dimensions: - BatchLength * BatchWidth * ListSize is dimensions[i].VectorCount - Height * Width * Depth * Channels is dimensions[i].VectorSize """ return Blob.Blob(self._internal.get_embeddings(index))
def recurrent_weights(self): """Gets the FC_recur weights. The dimensions: - **BatchLength** * **BatchWidth** * **ListSize** is hidden_size - **Height** * **Width** * **Depth** * **Channels** is hidden_size """ return Blob.Blob(self._internal.get_recurrent_weights())
def addends(self): """Gets the trainable vectors added. The blob dimensions: - BatchLength, BatchWidth are 1 - the other dimensions are the same as for the input """ return Blob.Blob(self._internal.get_addends())
def input_weights(self): """Gets the input weights matrix. The dimensions: - **BatchLength** * **BatchWidth** * **ListSize** is hidden_size - **Height** * **Width** * **Depth** * **Channels** is the same as for the input """ return Blob.Blob(self._internal.get_input_weights())
def main_weights(self): """Gets the output weights as a 2d matrix of the size: - **BatchLength** * **BatchWidth** * **ListSize** equal to **hidden_size** - **Height** * **Width** * **Depth** * **Channels** equal to this dimension of the input plus hidden_size """ return Blob.Blob(self._internal.get_main_weights())
def filter(self): """Gets the filters. The dimensions: - **BatchLength** * **BatchWidth** * **ListSize** is filter_count - **Height**, **Width**, **Depth** are taken from filter_size - **Channels** is equal to the inputs' **Channels** """ return Blob.Blob(self._internal.get_filter())
def filter(self): """Gets the filters. The dimensions: - BatchLength is 1 - BatchWidth is filter_count - Height is filter_size - Width, Depth are 1 - Channels is the inputs' Height * Width * Depth * Channels """ return Blob(self._internal.get_filter())
def filter(self): """Gets the trained weights for each gate. The blob dimensions: - **BatchLength** is 1 - **BatchWidth** is 3 * hidden_size (contains the weights for each of the three gates in the order: update, forget, output) - **Height** is window_size - **Width**, **Depth** are 1 - **Channels** is equal to the input's **Height** * **Width** * **Depth** * **Channels** """ return Blob.Blob(self._internal.get_filter())
def call_loss_calculator(data, labels, loss_calculator): """Calculates the value of specified custom loss function. :param neoml.Blob.Blob data: the network response. :param neoml.Blob.Blob labels: the correct labels. :param neoml.Dnn.CustomLossCalculatorBase loss_calculator: a user-implemented object that provides the method to calculate the custom loss. """ data_blob = Blob.Blob(data) labels_blob = Blob.Blob(labels) loss = loss_calculator.calc(data_blob, labels_blob) if not type(loss) is Blob.Blob: raise ValueError("The result of 'calc' must be neoml.Blob.") if loss.size != data_blob.object_count: raise ValueError( "The result of 'calc' must have size == data.object_count.") return loss._internal
def input_weights(self): """Gets the input hidden layer weights. The blob size is (4*HiddenSize)x1x1xInputSize. """ return Blob.Blob(self._internal.get_input_weights())
def get_blob(self): """Gets the data blob. """ return Blob.Blob(self._internal.get_blob())
def main_free_term(self): """Gets the output free terms as a blob of total hidden_size size. """ return Blob.Blob(self._internal.get_main_free_term())
def scale(self): """Gets scale, one of the trainable parameters in the formula. The total blob size is equal to the input **Height** * **Width** * **Depth** * **Channels**. """ return Blob.Blob(self._internal.get_scale())
def free_term(self): """Gets the free term. The blob size is filter_count. """ return Blob.Blob(self._internal.get_free_term())
def input_free_term(self): """Gets the FC_input free term, of hidden_size length. """ return Blob.Blob(self._internal.get_input_free_term())
def recurrent_free_term(self): """Gets the recurrent free term. """ return Blob.Blob(self._internal.get_recurrent_free_term())
def bias(self): """Gets the bias vector, of hidden_size length. """ return Blob.Blob(self._internal.get_recurrent_weights())
def bias(self): """Gets bias, one of the trainable parameters in the formula. The total blob size is equal to the input Height * Width * Depth * Channels. """ return Blob.Blob(self._internal.get_bias())
def get_blob(self): """Gets the blob with source data. """ return Blob.Blob(self._internal.get_blob())
def free_term(self): """Gets the free term for all three gates in the same order. The blob size is 3 * hidden_size. """ return Blob.Blob(self._internal.get_free_term())
def input_free_term(self): """Gets the input free term. """ return Blob.Blob(self._internal.get_input_free_term())
def weights(self): """Gets the trained weights as a blob of the dimensions: - BatchLength * BatchWidth * ListSize equal to element_count - Height, Width, Depth, Channels the same as for the first input """ return Blob.Blob(self._internal.get_weights())
def recurrent_weights(self): """Gets the recurrent hidden layer weights. The blob size is (4*HiddenSize)x1x1xHiddenSize. """ return Blob.Blob(self._internal.get_recurrent_weights())
def free_term(self): """Gets the free term vector, of element_count length. """ return Blob.Blob(self._internal.get_free_term())
def input_weights(self): """Gets the FC_input weights. The dimensions: - BatchLength * BatchWidth * ListSize is hidden_size - Height * Width * Depth * Channels is the same as for the input """ return Blob.Blob(self._internal.get_input_weights())
def gate_free_term(self): """Gets the gate free terms as a blob of total 2 * hidden_size size. """ return Blob.Blob(self._internal.get_gate_free_term())
def recurrent_free_term(self): """Gets the FC_recur free term, of hidden_size length. """ return Blob.Blob(self._internal.get_recurrent_free_term())
def free_term(self): """Gets the free term. The blob size is inputs' Channels. """ return Blob.Blob(self._internal.get_free_term())