本文整理匯總了Python中cntk.output_variable方法的典型用法代碼示例。如果您正苦於以下問題:Python cntk.output_variable方法的具體用法?Python cntk.output_variable怎麽用?Python cntk.output_variable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cntk
的用法示例。
在下文中一共展示了cntk.output_variable方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: infer_outputs
# 需要導入模塊: import cntk [as 別名]
# 或者: from cntk import output_variable [as 別名]
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)]
示例2: infer_outputs
# 需要導入模塊: import cntk [as 別名]
# 或者: from cntk import output_variable [as 別名]
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),]
示例3: infer_outputs
# 需要導入模塊: import cntk [as 別名]
# 或者: from cntk import output_variable [as 別名]
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),]
示例4: infer_outputs
# 需要導入模塊: import cntk [as 別名]
# 或者: from cntk import output_variable [as 別名]
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)]
示例5: infer_outputs
# 需要導入模塊: import cntk [as 別名]
# 或者: from cntk import output_variable [as 別名]
def infer_outputs(self):
batch_axis = C.Axis.default_batch_axis()
return [
C.output_variable(
self.target_shape,
self.inputs[0].dtype,
[batch_axis])]