torch.nn.functional.avg_pool2d(input, kernel_size, stride=None, padding=0, ceil_mode=False, count_include_pad=True) 在kh x kw区域中应用步长为dh x dw的二维平均池化操作。输出特征的数量等于输入平面的数量。 有关详细信息和输出形状,请参阅AvgPool2d。 参数:-input– 输入的张量 (minibatch x in...
torch.nn.functional.conv2d(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1) 在由几个输入平面组成的输入图像上应用2D卷积。 有关详细信息和输出形状,查看Conv2d。 参数: input– 输入的张量 (minibatch x in_channels x iH x iW) ...
torch.nn.functional.avg_pool2d(input, kernel_size, stride=None, padding=0, ceil_mode=False, count_include_pad=True)→ Tensorsource通过步长dh x dw步骤在kh x kw区域中应用二维平均池操作。输出特征的数量等于输入平面的数量。有关详细信息和输出形状,参考AvgPool2d...
torch.nn.functional.avg_pool2d(input, kernel_size, stride=None, padding=0, ceil_mode=False, count_include_pad=True, divisor_override=None) → Tensor Applies 2D average-pooling operation in kH×kWkH \times kWkH×kW regions by step size sH×sWsH \times sWsH×sW steps. The number of outpu...
from torch.autograd.functional import jacobian, hessian from torch.nn import Linear, AvgPool2d fc = Linear(4, 2) pool = AvgPool2d(kernel_size=2) def scalar_func(x): y = x ** 2 z = torch.sum(y) return z def vector_func(x): y = fc(x) return y def mat_func(x): x = x...
torch.nn.functional.avg_pool1d(input, kernel_size, stride=None, padding=0, ceil_mode=False, count_include_pad=True) 对由几个输入平面组成的输入信号进行一维平均池化。 有关详细信息和输出形状,请参阅AvgPool1d。 参数: - kernel_size – 窗口的大小 ...
class torch.nn.AvgPool2d(kernel_size, stride=None, padding=0, ceil_mode=False, count_include_pad=True) return_indices - 如果等于True,会返回输出最大值的序号,对于上采样操作会有帮助 ceil_mode - 如果等于True,计算输出信号大小的时候,会使用向上取整,代替默认的向下取整的操作 ...
More from torch.nn.functional .bilinear() .cosine_similarity() .kl_div() .relu() .binary_cross_entropy() .avg_pool2d() .nll_loss() .softmax() .tanh() .pad() .max_pool2d() .normalize() .leaky_relu() .conv2d() .affine_grid() .batch_norm() .linear...
fromtorch.autograd.functionalimportjacobian, hessianfromtorch.nnimportLinear, AvgPool2d fc = Linear(4,2) pool = AvgPool2d(kernel_size=2)defscalar_func(x): y = x **2z = torch.sum(y)returnzdefvector_func(x): y = fc(x)returnydefmat_func(x): ...
F.max_pool2d(input, kernel_size):应用二维最大池化。F.avg_pool2d(input, kernel_size):应用二维平均池化。归一化:F.batch_norm(input, running_mean, running_var):应用批归一化。F.layer_norm(input, normalized_shape):应用层归一化。torch.nn.functional 模块中的函数通常是无状态的,这意味着它们...