Beispiel #1
0
    def process(self, ellLayers):
        """Appends the ELL representation of the current layer to ellLayers."""

        # Create the ell.LayerParameters for the ELL layer
        layerParameters = ell.LayerParameters(
            self.layer.ell_inputShape, self.layer.ell_inputPaddingParameters, self.layer.ell_outputShape, self.layer.ell_outputPaddingParameters)

        bias = -1.0 * self.layer.constants[0].value
        if len(bias.shape) == 0:
            biasVector = converters.get_float_vector_from_constant(bias, layerParameters.outputShape.channels)
        else:
            biasVector = converters.get_float_vector_from_cntk_array(bias)

        # Create the ELL bias layer
        ellLayers.append(ell.FloatBiasLayer(layerParameters, biasVector))
Beispiel #2
0
    def process(self, ellLayers):
        """Appends the ELL representation of the current layer to ellLayers."""

        # Create the ELL.LayerParameters for the ELL layer
        layerParameters = ELL.LayerParameters(
            self.layer.ell_inputShape, self.layer.ell_inputPaddingParameters,
            self.layer.ell_outputShape, self.layer.ell_outputPaddingParameters)

        # Create ELL scaling layer
        if (self.scale.value.size == 1):
            scalesVector = converters.get_float_vector_from_constant(
                self.scale.value, layerParameters.outputShape.channels)
        else:
            scalesVector = converters.get_float_vector_from_cntk_array(
                self.scale.value)

        ellLayers.append(ELL.FloatScalingLayer(layerParameters, scalesVector))