當前位置: 首頁>>代碼示例>>Python>>正文


Python _C.modulated_deform_conv_backward方法代碼示例

本文整理匯總了Python中maskrcnn_benchmark._C.modulated_deform_conv_backward方法的典型用法代碼示例。如果您正苦於以下問題:Python _C.modulated_deform_conv_backward方法的具體用法?Python _C.modulated_deform_conv_backward怎麽用?Python _C.modulated_deform_conv_backward使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在maskrcnn_benchmark._C的用法示例。


在下文中一共展示了_C.modulated_deform_conv_backward方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: backward

# 需要導入模塊: from maskrcnn_benchmark import _C [as 別名]
# 或者: from maskrcnn_benchmark._C import modulated_deform_conv_backward [as 別名]
def backward(ctx, grad_output):
        if not grad_output.is_cuda:
            raise NotImplementedError
        input, offset, mask, weight, bias = ctx.saved_tensors
        grad_input = torch.zeros_like(input)
        grad_offset = torch.zeros_like(offset)
        grad_mask = torch.zeros_like(mask)
        grad_weight = torch.zeros_like(weight)
        grad_bias = torch.zeros_like(bias)
        _C.modulated_deform_conv_backward(
            input,
            weight,
            bias,
            ctx._bufs[0],
            offset,
            mask,
            ctx._bufs[1],
            grad_input,
            grad_weight,
            grad_bias,
            grad_offset,
            grad_mask,
            grad_output,
            weight.shape[2],
            weight.shape[3],
            ctx.stride,
            ctx.stride,
            ctx.padding,
            ctx.padding,
            ctx.dilation,
            ctx.dilation,
            ctx.groups,
            ctx.deformable_groups,
            ctx.with_bias
        )
        if not ctx.with_bias:
            grad_bias = None

        return (grad_input, grad_offset, grad_mask, grad_weight, grad_bias,
                None, None, None, None, None) 
開發者ID:simaiden,項目名稱:Clothing-Detection,代碼行數:42,代碼來源:deform_conv_func.py

示例2: backward

# 需要導入模塊: from maskrcnn_benchmark import _C [as 別名]
# 或者: from maskrcnn_benchmark._C import modulated_deform_conv_backward [as 別名]
def backward(ctx, grad_output):
        if not grad_output.is_cuda:
            raise NotImplementedError
        input, offset, mask, weight, bias = ctx.saved_tensors
        grad_input = torch.zeros_like(input)
        grad_offset = torch.zeros_like(offset)
        grad_mask = torch.zeros_like(mask)
        grad_weight = torch.zeros_like(weight)
        grad_bias = torch.zeros_like(bias)
        _C.modulated_deform_conv_backward(
            input, 
            weight, 
            bias, 
            ctx._bufs[0], 
            offset, 
            mask, 
            ctx._bufs[1],
            grad_input, 
            grad_weight, 
            grad_bias, 
            grad_offset, 
            grad_mask,
            grad_output, 
            weight.shape[2], 
            weight.shape[3], 
            ctx.stride,
            ctx.stride, 
            ctx.padding, 
            ctx.padding, 
            ctx.dilation, 
            ctx.dilation,
            ctx.groups, 
            ctx.deformable_groups, 
            ctx.with_bias
        )
        if not ctx.with_bias:
            grad_bias = None

        return (grad_input, grad_offset, grad_mask, grad_weight, grad_bias,
                None, None, None, None, None) 
開發者ID:HuangQinJian,項目名稱:DF-Traffic-Sign-Identification,代碼行數:42,代碼來源:deform_conv_func.py


注:本文中的maskrcnn_benchmark._C.modulated_deform_conv_backward方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。