예제 #1
0
 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())
예제 #2
0
    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())
예제 #3
0
 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))
예제 #4
0
파일: Irnn.py 프로젝트: vishalbelsare/neoml
    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())
예제 #5
0
    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())
예제 #6
0
    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())
예제 #7
0
파일: Gru.py 프로젝트: vishalbelsare/neoml
    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())
예제 #8
0
파일: Conv.py 프로젝트: vishalbelsare/neoml
    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())
예제 #9
0
 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())
예제 #10
0
파일: Qrnn.py 프로젝트: vishalbelsare/neoml
    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())
예제 #11
0
파일: Loss.py 프로젝트: neoml-lib/neoml
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
예제 #12
0
파일: Lstm.py 프로젝트: vishalbelsare/neoml
 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())
예제 #13
0
파일: Sink.py 프로젝트: vishalbelsare/neoml
 def get_blob(self):
     """Gets the data blob.
     """
     return Blob.Blob(self._internal.get_blob())
예제 #14
0
파일: Gru.py 프로젝트: vishalbelsare/neoml
 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())
예제 #15
0
 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())
예제 #16
0
파일: Conv.py 프로젝트: vishalbelsare/neoml
 def free_term(self):
     """Gets the free term. The blob size is filter_count.
     """
     return Blob.Blob(self._internal.get_free_term())
예제 #17
0
 def input_free_term(self):
     """Gets the FC_input free term, of hidden_size length.
     """
     return Blob.Blob(self._internal.get_input_free_term())
예제 #18
0
파일: Lstm.py 프로젝트: vishalbelsare/neoml
 def recurrent_free_term(self):
     """Gets the recurrent free term.
     """
     return Blob.Blob(self._internal.get_recurrent_free_term())
예제 #19
0
 def bias(self):
     """Gets the bias vector, of hidden_size length.
     """
     return Blob.Blob(self._internal.get_recurrent_weights())
예제 #20
0
 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())
예제 #21
0
 def get_blob(self):
     """Gets the blob with source data.
     """
     return Blob.Blob(self._internal.get_blob())
예제 #22
0
파일: Qrnn.py 프로젝트: vishalbelsare/neoml
 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())
예제 #23
0
파일: Lstm.py 프로젝트: vishalbelsare/neoml
 def input_free_term(self):
     """Gets the input free term.
     """
     return Blob.Blob(self._internal.get_input_free_term())
예제 #24
0
 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())
예제 #25
0
파일: Lstm.py 프로젝트: vishalbelsare/neoml
 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())
예제 #26
0
 def free_term(self):
     """Gets the free term vector, of element_count length.
     """
     return Blob.Blob(self._internal.get_free_term())
예제 #27
0
 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())
예제 #28
0
파일: Gru.py 프로젝트: vishalbelsare/neoml
 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())
예제 #29
0
 def recurrent_free_term(self):
     """Gets the FC_recur free term, of hidden_size length.
     """
     return Blob.Blob(self._internal.get_recurrent_free_term())
예제 #30
0
파일: Conv.py 프로젝트: vishalbelsare/neoml
 def free_term(self):
     """Gets the free term. The blob size is inputs' Channels.
     """
     return Blob.Blob(self._internal.get_free_term())