class_docstr: Class implementing a convolutional layer in the interval/box domain.
class_docstr_tok: ["Class","implementing","a","convolutional","layer","in","the","interval\/box","domain","."]
docstr: Method for efficiently interfacing with adversarial attacks.
  
  Backpropagating through concrete_forward is too slow if adversarial attacks need to be generated on-the fly
  or require a large amount of iterations.
  
  This method will create a regular conv layer with the right parameters to use.
  
  :param x: concrete input to the convolutional layer.
  :return: output of the convolutional layer on x
docstr_tok: ["Method","for","efficiently","interfacing","with","adversarial","attacks",".","Backpropagating","through","concrete_forward","is","too","slow","if","adversarial","attacks","need","to","be","generated","on-the","fly","or","require","a","large","amount","of","iterations",".","This","method","will","create","a","regular","conv","layer","with","the","right","parameters","to","use",".",":","param","x",":","concrete","input","to","the","convolutional","layer",".",":","return",":","output","of","the","convolutional","layer","on","x"]
code: def conv_forward(self, x: "torch.Tensor") -> "torch.Tensor":
      """
      Method for efficiently interfacing with adversarial attacks.
  
      Backpropagating through concrete_forward is too slow if adversarial attacks need to be generated on-the fly
      or require a large amount of iterations.
  
      This method will create a regular conv layer with the right parameters to use.
  
      :param x: concrete input to the convolutional layer.
      :return: output of the convolutional layer on x
      """
      if self.cnn is None:
          self.cnn = torch.nn.Conv2d(
              in_channels=self.in_channels,
              out_channels=self.out_channels,
              kernel_size=self.kernel_size,
              bias=self.include_bias,
              stride=self.stride,
              padding=self.padding,
              dilation=self.dilation,
          ).to(self.device)
      if isinstance(self.kernel_size, tuple):
          self.cnn.weight.data = torch.reshape(
              torch.tensor(
                  self.conv.weight.data.cpu().detach().numpy()
              ),
              (
                  self.out_channels,
                  self.in_channels,
                  self.kernel_size[0],
                  self.kernel_size[1],
              ),
          ).to(self.device)
      else:
          self.cnn.weight.data = torch.reshape(
              torch.tensor(
                  self.conv.weight.data.cpu().detach().numpy()
              ),
              (
                  self.out_channels,
                  self.in_channels,
                  self.kernel_size,
                  self.kernel_size,
              ),
          ).to(self.device)
      if self.cnn.bias is not None and self.bias_to_grad is not None:
          self.cnn.bias.data = torch.tensor(
              self.bias_to_grad.data.cpu().detach().numpy()
          ).to(self.device)
  
      if self.cnn is not None:
          return self.cnn(x)
      raise ValueError(
          "The convolutional layer for attack mode was not created properly"
      )
  
imports: from typing import List, Union, Tuple, Optional
  import torch
  import numpy
label_desc: Use image node_id 6 for calling the PyTorchIntervalConv2D obj's underlying member method code with example usage: obj.conv_forward(x) and returns: self