./src/convolutional_layer.c:153:13: error: 'CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT' undeclared (first use in this function) 153 | CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
时间: 2023-05-17 07:06:40 浏览: 88
这个错误是由于在 convolutional_layer.c 文件的第 153 行中使用了未声明的 CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT 变量导致的。可能是您的代码中缺少了必要的头文件或库文件,或者您的代码中使用了不兼容的版本。建议您检查代码并确保所有必要的头文件和库文件都已正确包含。
相关问题
class DownConv(nn.Module): def __init__(self, seq_len=200, hidden_size=64, m_segments=4,k1=10,channel_reduction=16): super().__init__() """ DownConv is implemented by stacked strided convolution layers and more details can be found below. When the parameters k_1 and k_2 are determined, we can soon get m in Eq.2 of the paper. However, we are more concerned with the size of the parameter m, so we searched for a combination of parameter m and parameter k_1 (parameter k_2 can be easily calculated in this process) to find the optimal segment numbers. Args: input_tensor (torch.Tensor): the input of the attention layer Returns: output_conv (torch.Tensor): the convolutional outputs in Eq.2 of the paper """ self.m =m_segments self.k1 = k1 self.channel_reduction = channel_reduction # avoid over-parameterization middle_segment_length = seq_len/k1 k2=math.ceil(middle_segment_length/m_segments) padding = math.ceil((k2*self.m-middle_segment_length)/2.0) # pad the second convolutional layer appropriately self.conv1a = nn.Conv1d(in_channels=hidden_size, out_channels=hidden_size // self.channel_reduction, kernel_size=self.k1, stride=self.k1) self.relu1a = nn.ReLU(inplace=True) self.conv2a = nn.Conv1d(in_channels=hidden_size // self.channel_reduction, out_channels=hidden_size, kernel_size=k2, stride=k2, padding = padding) def forward(self, input_tensor): input_tensor = input_tensor.permute(0, 2, 1) x1a = self.relu1a(self.conv1a(input_tensor)) x2a = self.conv2a(x1a) if x2a.size(2) != self.m: print('size_erroe, x2a.size_{} do not equals to m_segments_{}'.format(x2a.size(2),self.m)) output_conv = x2a.permute(0, 2, 1) return output_conv
这是一个用于实现降采样卷积(DownConv)的PyTorch模型类。在构造函数中,需要指定一些参数,包括序列长度seq_len,隐藏层大小hidden_size,中间段数m_segments,卷积核大小k1和通道缩减channel_reduction。其中,降采样卷积层的实现使用了两个卷积层,第一个卷积层的卷积核大小为k1,步长为k1,将输入张量进行降采样;第二个卷积层的卷积核大小为k2,步长为k2,将第一个卷积层的输出进行进一步的降采样,并按照论文中的公式计算得到输出张量。为了使得第二个卷积层的输出张量大小与中间段数m_segments相等,需要在卷积层中进行适当的padding。在前向传播时,需要将输入张量进行维度变换,使得其可以被卷积层处理,然后将卷积层的输出张量再次进行维度变换,使得其可以作为下一层的输入。如果第二个卷积层的输出张量大小不等于中间段数m_segments,则会输出一条错误信息。
阅读全文