codecamp

TensorFlow函数教程:tf.nn.depthwise_conv2d

tf.nn.depthwise_conv2d函数

tf.nn.depthwise_conv2d(
    input,
    filter,
    strides,
    padding,
    rate=None,
    name=None,
    data_format=None
)

定义在:tensorflow/python/ops/nn_impl.py.

请参阅指南:神经网络>卷积运算

深度 2-D 卷积.

给定4D输入张量(数据格式为'NHWC'或'NCHW')和形状为[filter_height, filter_width, in_channels, channel_multiplier]的滤波器张量,它包含深度为1的in_channels卷积滤波器,depthwise_conv2d对每个输入通道应用不同的滤波器(从1通道扩展到每个通道channel_multiplier),然后将结果连接在一起.输出有in_channels * channel_multiplier个通道.

详细地,

output[b, i, j, k * channel_multiplier + q] = sum_{di, dj}
     filter[di, dj, k, q] * input[b, strides[1] * i + rate[0] * di,
                                     strides[2] * j + rate[1] * dj, k]

必须有strides[0] = strides[3] = 1.对于相同水平和垂直步幅的最常见情况,strides = [1, stride, stride, 1].如果rate中的任何值大于1,我们执行等值深度卷积,在这种情况下,strides张量中的所有值必须等于1.

参数:

  • input:4-D,形状根据data_format得出.
  • filter:4-D,形状为[filter_height, filter_width, in_channels, channel_multiplier].
  • strides:1-D,大小为4,input每个尺寸的滑动窗口的步幅.
  • padding:一个字符串,可以是'VALID'或者'SAME',填充算法.
  • rate:1-D,大小为2;我们在等值卷积中在heightwidth维度上对输入值进行采样的扩张率.如果它大于1,则步幅的所有值必须为1.
  • name:此操作的名称(可选).
  • data_format:输入的数据格式,可以是“NHWC”(默认)或“NCHW”.

返回:

4-DTensor, 形状工具data_format得到.例如,对于“NHWC”格式,形状是[batch, out_height, out_width, in_channels * channel_multiplier].

TensorFlow函数教程:tf.nn.ctc_loss
TensorFlow函数教程:tf.nn.depthwise_conv2d_native
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

TensorFlow 函数介绍

TensorFlow 函数模块:tf

TensorFlow的image模块

TensorFlow使用之tf.io

TensorFlow使用之tf.keras

TensorFlow函数教程:tf.keras.applications

TensorFlow函数教程:tf.keras.backend

TensorFlow使用之tf.metrics

TensorFlow使用之tf.nn

TensorFlow使用之tf.python_io

TensorFlow 功能函数

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }