speechbrain.nnet.complex_networks.c_ops 模块

This library implements different operations needed by complex-

有价值的架构。 这项工作受到以下启发:Trabelsi C.等人的“深度复杂网络”。

Authors
  • Titouan Parcollet 2020

摘要

函数:

affect_conv_init

应用给定的权重初始化函数到参数上。

affect_init

应用给定的权重初始化函数到参数上。

check_complex_input

检查线性层的复数值形状。

complex_conv_op

对输入数据应用复杂的卷积。

complex_init

返回一个复数矩阵,初始化方式如《深度复数网络》中所述,作者:Trabelsi C.

complex_linear_op

对输入数据应用复杂的线性变换。

get_conjugate

返回输入复数的共轭(z = r - xi)。

get_imag

返回复数输入的虚部。

get_real

返回复数值输入的实部。

multi_mean

input的多个维度执行torch.mean

unitary_init

返回一个由单位复数组成的矩阵。

参考

speechbrain.nnet.complex_networks.c_ops.check_complex_input(input_shape)[source]

检查线性层的复数值形状。

Parameters:

input_shape (tuple) – 输入的预期形状。

speechbrain.nnet.complex_networks.c_ops.get_real(input, input_type='linear', channels_axis=1)[source]

返回复数值输入的实际部分。

Parameters:
  • 输入 (torch.Tensor) – 输入张量。

  • input_type (str,) – (卷积, 线性) (默认 “linear”)

  • channels_axis (int.) – 默认值为1。

Return type:

复数值输入的实部。

speechbrain.nnet.complex_networks.c_ops.get_imag(input, input_type='linear', channels_axis=1)[source]

返回复数值输入的虚部。

Parameters:
  • 输入 (torch.Tensor) – 输入张量。

  • input_type (str) – (卷积, 线性) (默认 “linear”)

  • channels_axis (int) – 默认值为1。

Return type:

复数值输入的虚部。

speechbrain.nnet.complex_networks.c_ops.get_conjugate(input, input_type='linear', channels_axis=1)[source]

返回输入复数的共轭(z = r - xi)。

Parameters:
  • 输入 (torch.Tensor) – 输入张量

  • input_type (str,) – (卷积, 线性) (默认 “linear”)

  • channels_axis (int.) – 默认值为1。

Return type:

输入复数的共轭。

speechbrain.nnet.complex_networks.c_ops.complex_linear_op(input, real_weight, imag_weight, bias)[source]

对输入数据应用复杂的线性变换。

Parameters:
  • input (torch.Tensor) – 要进行变换的复数输入张量。

  • real_weight (torch.Parameter) – 该层四元数权重矩阵的实部。

  • imag_weight (torch.Parameter) – 该层四元数权重矩阵的第一个虚部。

  • 偏差 (torch.Parameter)

Return type:

应用复杂线性变换后的输出。

speechbrain.nnet.complex_networks.c_ops.complex_conv_op(input, real_weight, imag_weight, bias, stride, padding, dilation, conv1d)[source]

对输入数据应用复杂的卷积。

Parameters:
  • input (torch.Tensor) – 要进行变换的复数输入张量。

  • real_weight (torch.Parameter) – 该层四元数权重矩阵的实部。

  • imag_weight (torch.Parameter) – 该层四元数权重矩阵的第一个虚部。

  • 偏差 (torch.Parameter)

  • stride (int) – 卷积滤波器的步长因子。

  • padding (int) – 填充量。有关更多信息,请参阅 torch.nn 文档。

  • dilation (int) – 卷积滤波器的扩张因子。

  • conv1d (bool) – 如果为真,将应用一维卷积操作。否则,将调用二维卷积。

Return type:

应用复杂卷积后的输出。

speechbrain.nnet.complex_networks.c_ops.unitary_init(in_features, out_features, kernel_size=None, criterion='glorot')[source]

返回一个单位复数的矩阵。

Parameters:
  • in_features (int) – 输入层的实数值数量(四元数 // 4)。

  • out_features (int) – 输出层的实数值数量(四元数 // 4)。

  • kernel_size (int) – 卷积层的核大小(例如:(3,3))。

  • criterion (str) – (glorot, he) (默认 “glorot”).

Return type:

单位复数的矩阵。

speechbrain.nnet.complex_networks.c_ops.complex_init(in_features, out_features, kernel_size=None, criterion='glorot')[source]

返回一个复数矩阵,初始化方式如下: “深度复数网络”,Trabelsi C. 等人。

Parameters:
  • in_features (int) – 输入层的实数值数量(四元数 // 4)。

  • out_features (int) – 输出层的实值数量(四元数 // 4)。

  • kernel_size (int) – 卷积层的核大小(例如:(3,3))。

  • criterion (str) – (glorot, he) (默认 “glorot”)

Return type:

初始化的复数矩阵。

speechbrain.nnet.complex_networks.c_ops.affect_init(real_weight, imag_weight, init_func, criterion)[source]

将给定的权重初始化函数应用于参数。

Parameters:
  • real_weight (torch.Parameters)

  • imag_weight (torch.Parameters)

  • init_func (function) – (unitary_init, complex_init)

  • criterion (str) – (glorot, he)

speechbrain.nnet.complex_networks.c_ops.affect_conv_init(real_weight, imag_weight, kernel_size, init_func, criterion)[source]

将给定的权重初始化函数应用于参数。 这是专门为卷积层编写的。

Parameters:
  • real_weight (torch.Parameters)

  • imag_weight (torch.Parameters)

  • kernel_size (int)

  • init_func (function) – (unitary_init, complex_init)

  • criterion (str) – (glorot, he)

speechbrain.nnet.complex_networks.c_ops.multi_mean(input, axes, keepdim=False)[source]

input的多个维度执行torch.mean