本文整理汇总了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])]