Python cntk.output_variable() Examples

The following are 30 code examples of cntk.output_variable(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module cntk , or try the search function .
Example #1
Source File: anchor_target_layer.py    From cntk-python-web-service-on-azure with MIT License 6 votes vote down vote up
def infer_outputs(self):
        # This is a necessary work around since anfter cloning the cloned inputs are just place holders without the proper shape
        if self._cfm_shape is None:
            self._cfm_shape = self.inputs[0].shape
        height, width = self._cfm_shape[-2:]

        if DEBUG:
            print('AnchorTargetLayer: height', height, 'width', width)

        A = self._num_anchors
        # labels
        labelShape = (1, A, height, width)
        # Comment: this layer uses encoded labels, while in CNTK we mostly use one hot labels
        # bbox_targets
        bbox_target_shape = (1, A * 4, height, width)
        # bbox_inside_weights
        bbox_inside_weights_shape = (1, A * 4, height, width)

        return [output_variable(labelShape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="objectness_target", needs_gradient=False),
                output_variable(bbox_target_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="rpn_bbox_target", needs_gradient=False),
                output_variable(bbox_inside_weights_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="rpn_bbox_inside_w", needs_gradient=False),] 
Example #2
Source File: proposal_target_layer.py    From cntk-hotel-pictures-classificator with MIT License 6 votes vote down vote up
def infer_outputs(self):
        # sampled rois (0, x1, y1, x2, y2)
        # for CNTK the proposal shape is [4 x roisPerImage], and mirrored in Python
        rois_shape = (FreeDimension, 4)
        labels_shape = (FreeDimension, self._num_classes)
        bbox_targets_shape = (FreeDimension, self._num_classes * 4)
        bbox_inside_weights_shape = (FreeDimension, self._num_classes * 4)

        return [output_variable(rois_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="rpn_target_rois_raw", needs_gradient=False),
                output_variable(labels_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="label_targets_raw", needs_gradient=False),
                output_variable(bbox_targets_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="bbox_targets_raw", needs_gradient=False),
                output_variable(bbox_inside_weights_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="bbox_inside_w_raw", needs_gradient=False)] 
Example #3
Source File: anchor_target_layer.py    From cntk-hotel-pictures-classificator with MIT License 6 votes vote down vote up
def infer_outputs(self):
        # This is a necessary work around since anfter cloning the cloned inputs are just place holders without the proper shape
        if self._cfm_shape is None:
            self._cfm_shape = self.inputs[0].shape
        height, width = self._cfm_shape[-2:]

        if DEBUG:
            print('AnchorTargetLayer: height', height, 'width', width)

        A = self._num_anchors
        # labels
        labelShape = (1, A, height, width)
        # Comment: this layer uses encoded labels, while in CNTK we mostly use one hot labels
        # bbox_targets
        bbox_target_shape = (1, A * 4, height, width)
        # bbox_inside_weights
        bbox_inside_weights_shape = (1, A * 4, height, width)

        return [output_variable(labelShape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="objectness_target", needs_gradient=False),
                output_variable(bbox_target_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="rpn_bbox_target", needs_gradient=False),
                output_variable(bbox_inside_weights_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="rpn_bbox_inside_w", needs_gradient=False),] 
Example #4
Source File: anchor_target_layer.py    From raster-deep-learning with Apache License 2.0 6 votes vote down vote up
def infer_outputs(self):
        # This is a necessary work around since after cloning the cloned inputs are just place holders without the proper shape
        if self._cfm_shape is None:
            self._cfm_shape = self.inputs[0].shape
        height, width = self._cfm_shape[-2:]

        if DEBUG:
            print('AnchorTargetLayer: height', height, 'width', width)

        A = self._num_anchors
        # labels
        labelShape = (1, A, height, width)
        # Comment: this layer uses encoded labels, while in CNTK we mostly use one hot labels
        # bbox_targets
        bbox_target_shape = (1, A * 4, height, width)
        # bbox_inside_weights
        bbox_inside_weights_shape = (1, A * 4, height, width)

        return [output_variable(labelShape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="objectness_target", needs_gradient=False),
                output_variable(bbox_target_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="rpn_bbox_target", needs_gradient=False),
                output_variable(bbox_inside_weights_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="rpn_bbox_inside_w", needs_gradient=False),] 
Example #5
Source File: proposal_target_layer.py    From raster-deep-learning with Apache License 2.0 6 votes vote down vote up
def infer_outputs(self):
        # sampled rois (0, x1, y1, x2, y2)
        # for CNTK the proposal shape is [4 x roisPerImage], and mirrored in Python
        rois_shape = (FreeDimension, 4)
        labels_shape = (FreeDimension, self._num_classes)
        bbox_targets_shape = (FreeDimension, self._num_classes * 4)
        bbox_inside_weights_shape = (FreeDimension, self._num_classes * 4)

        return [output_variable(rois_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="rpn_target_rois_raw", needs_gradient=False),
                output_variable(labels_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="label_targets_raw", needs_gradient=False),
                output_variable(bbox_targets_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="bbox_targets_raw", needs_gradient=False),
                output_variable(bbox_inside_weights_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="bbox_inside_w_raw", needs_gradient=False)] 
Example #6
Source File: proposal_target_layer.py    From cntk-python-web-service-on-azure with MIT License 6 votes vote down vote up
def infer_outputs(self):
        # sampled rois (0, x1, y1, x2, y2)
        # for CNTK the proposal shape is [4 x roisPerImage], and mirrored in Python
        rois_shape = (FreeDimension, 4)
        labels_shape = (FreeDimension, self._num_classes)
        bbox_targets_shape = (FreeDimension, self._num_classes * 4)
        bbox_inside_weights_shape = (FreeDimension, self._num_classes * 4)

        return [output_variable(rois_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="rpn_target_rois_raw", needs_gradient=False),
                output_variable(labels_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="label_targets_raw", needs_gradient=False),
                output_variable(bbox_targets_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="bbox_targets_raw", needs_gradient=False),
                output_variable(bbox_inside_weights_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="bbox_inside_w_raw", needs_gradient=False)] 
Example #7
Source File: cntk_backend.py    From DeepLearning_Wavelet-LSTM with MIT License 5 votes vote down vote up
def infer_outputs(self):
        batch_axis = C.Axis.default_batch_axis()
        return [
            C.output_variable(
                self.target_shape,
                self.inputs[0].dtype,
                [batch_axis])] 
Example #8
Source File: cntk_backend.py    From DeepLearning_Wavelet-LSTM with MIT License 5 votes vote down vote up
def infer_outputs(self):
        return [
            C.output_variable(
                self.target_shape,
                self.inputs[0].dtype,
                [])] 
Example #9
Source File: cntk_backend.py    From DeepLearning_Wavelet-LSTM with MIT License 5 votes vote down vote up
def infer_outputs(self):
        return [
            C.output_variable(
                self.inputs[0].shape,
                self.inputs[0].dtype,
                self.inputs[0].dynamic_axes)] 
Example #10
Source File: cntk_backend.py    From DeepLearning_Wavelet-LSTM with MIT License 5 votes vote down vote up
def infer_outputs(self):
        batch_axis = C.Axis.default_batch_axis()
        return [
            C.output_variable(
                self.target_shape,
                self.inputs[0].dtype,
                [batch_axis])] 
Example #11
Source File: cntk_backend.py    From DeepLearning_Wavelet-LSTM with MIT License 5 votes vote down vote up
def infer_outputs(self):
        batch_axis = C.Axis.default_batch_axis()
        return [
            C.output_variable(
                self.inputs[0].shape[1:],
                self.inputs[0].dtype,
                [batch_axis])] 
Example #12
Source File: cntk_backend.py    From DeepLearning_Wavelet-LSTM with MIT License 5 votes vote down vote up
def infer_outputs(self):
        return [
            C.output_variable(
                self.target_shape,
                self.inputs[0].dtype,
                [])] 
Example #13
Source File: cntk_backend.py    From DeepLearning_Wavelet-LSTM with MIT License 5 votes vote down vote up
def infer_outputs(self):
        batch_axis = C.Axis.default_batch_axis()
        return [
            C.output_variable(
                self.target_shape,
                self.inputs[0].dtype,
                [batch_axis])] 
Example #14
Source File: cntk_backend.py    From DeepLearning_Wavelet-LSTM with MIT License 5 votes vote down vote up
def infer_outputs(self):
        batch_axis = C.Axis.default_batch_axis()
        return [
            C.output_variable(
                self.inputs[0].shape[1:],
                self.inputs[0].dtype,
                [batch_axis])] 
Example #15
Source File: cntk_backend.py    From DeepLearning_Wavelet-LSTM with MIT License 5 votes vote down vote up
def infer_outputs(self):
        return [
            C.output_variable(
                self.target_shape,
                self.inputs[0].dtype,
                [])] 
Example #16
Source File: cntk_backend.py    From DeepLearning_Wavelet-LSTM with MIT License 5 votes vote down vote up
def infer_outputs(self):
        return [
            C.output_variable(
                self.inputs[0].shape,
                self.inputs[0].dtype,
                self.inputs[0].dynamic_axes)] 
Example #17
Source File: cntk_backend.py    From deepQuest with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def infer_outputs(self):
        return [
            C.output_variable(
                self.target_shape,
                self.inputs[0].dtype,
                [])] 
Example #18
Source File: cntk_backend.py    From DeepLearning_Wavelet-LSTM with MIT License 5 votes vote down vote up
def infer_outputs(self):
        return [
            C.output_variable(
                self.target_shape,
                self.inputs[0].dtype,
                [])] 
Example #19
Source File: cntk_backend.py    From DeepLearning_Wavelet-LSTM with MIT License 5 votes vote down vote up
def infer_outputs(self):
        return [
            C.output_variable(
                self.inputs[0].shape,
                self.inputs[0].dtype,
                self.inputs[0].dynamic_axes)] 
Example #20
Source File: cntk_backend.py    From keras-lambda with MIT License 5 votes vote down vote up
def infer_outputs(self):
        return [
            C.output_variable(
                self.inputs[0].shape,
                self.inputs[0].dtype,
                self.inputs[0].dynamic_axes)] 
Example #21
Source File: proposal_layer.py    From cntk-hotel-pictures-classificator with MIT License 5 votes vote down vote up
def infer_outputs(self):
        # rois blob: holds R regions of interest, each is a 5-tuple
        # (n, x1, y1, x2, y2) specifying an image batch index n and a
        # rectangle (x1, y1, x2, y2)
        # for CNTK the proposal shape is [4 x roisPerImage], and mirrored in Python
        proposalShape = (FreeDimension, 4)

        return [output_variable(proposalShape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                            name="rpn_rois_raw", needs_gradient=False)] 
Example #22
Source File: cntk_backend.py    From deepQuest with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def infer_outputs(self):
        batch_axis = C.Axis.default_batch_axis()
        return [
            C.output_variable(
                self.target_shape,
                self.inputs[0].dtype,
                [batch_axis])] 
Example #23
Source File: cntk_backend.py    From keras-lambda with MIT License 5 votes vote down vote up
def infer_outputs(self):
        batch_axis = C.Axis.default_batch_axis()
        return [
            C.output_variable(
                self.target_shape,
                self.inputs[0].dtype,
                [batch_axis])] 
Example #24
Source File: cntk_backend.py    From deepQuest with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def infer_outputs(self):
        return [
            C.output_variable(
                self.inputs[0].shape,
                self.inputs[0].dtype,
                self.inputs[0].dynamic_axes)] 
Example #25
Source File: cntk_backend.py    From deepQuest with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def infer_outputs(self):
        batch_axis = C.Axis.default_batch_axis()
        return [
            C.output_variable(
                self.inputs[0].shape[1:],
                self.inputs[0].dtype,
                [batch_axis])] 
Example #26
Source File: cntk_backend.py    From DeepLearning_Wavelet-LSTM with MIT License 5 votes vote down vote up
def infer_outputs(self):
        batch_axis = C.Axis.default_batch_axis()
        return [
            C.output_variable(
                self.target_shape,
                self.inputs[0].dtype,
                [batch_axis])] 
Example #27
Source File: proposal_layer.py    From cntk-python-web-service-on-azure with MIT License 5 votes vote down vote up
def infer_outputs(self):
        # rois blob: holds R regions of interest, each is a 5-tuple
        # (n, x1, y1, x2, y2) specifying an image batch index n and a
        # rectangle (x1, y1, x2, y2)
        # for CNTK the proposal shape is [4 x roisPerImage], and mirrored in Python
        proposalShape = (FreeDimension, 4)

        return [output_variable(proposalShape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                            name="rpn_rois_raw", needs_gradient=False)] 
Example #28
Source File: cntk_backend.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def infer_outputs(self):
        batch_axis = C.Axis.default_batch_axis()
        return [
            C.output_variable(
                self.target_shape,
                self.inputs[0].dtype,
                [batch_axis])] 
Example #29
Source File: cntk_backend.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def infer_outputs(self):
        batch_axis = C.Axis.default_batch_axis()
        return [
            C.output_variable(
                self.inputs[0].shape[1:],
                self.inputs[0].dtype,
                [batch_axis])] 
Example #30
Source File: cntk_backend.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def infer_outputs(self):
        return [
            C.output_variable(
                self.target_shape,
                self.inputs[0].dtype,
                [])]