class_docstr: PreResNet unit with residual connection.
  
  Parameters:
  ----------
  in_channels : int
      Number of input channels.
  out_channels : int
      Number of output channels.
  stride : int or tuple/list of 2 int
      Strides of the convolution.
  bottleneck : bool
      Whether to use a bottleneck or simple block in units.
  conv1_stride : bool
      Whether to use stride in the first or the second convolution layer of the block.
class_docstr_tok: ["PreResNet","unit","with","residual","connection",".","Parameters",":","--","--","--","--","--","in_channels",":","int","Number","of","input","channels",".","out_channels",":","int","Number","of","output","channels",".","stride",":","int","or","tuple\/list","of","2","int","Strides","of","the","convolution",".","bottleneck",":","bool","Whether","to","use","a","bottleneck","or","simple","block","in","units",".","conv1_stride",":","bool","Whether","to","use","stride","in","the","first","or","the","second","convolution","layer","of","the","block","."]
code: def __init__(
      self, in_channels, out_channels, stride, bottleneck, conv1_stride
  ):
      super(PreResUnit, self).__init__()
      self.resize_identity = (in_channels != out_channels) or (
          stride != 1
      )
  
      if bottleneck:
          self.body = PreResBottleneck(
              in_channels=in_channels,
              out_channels=out_channels,
              stride=stride,
              conv1_stride=conv1_stride,
          )
      else:
          self.body = PreResBlock(
              in_channels=in_channels,
              out_channels=out_channels,
              stride=stride,
          )
      if self.resize_identity:
          self.identity_conv = conv1x1(
              in_channels=in_channels,
              out_channels=out_channels,
              stride=stride,
          )
  
imports: import numpy
  import torch
  from torch.autograd import Variable
  from pytorch2keras.converter import pytorch_to_keras
  import os
  import torch.nn
  import torch.nn.init
label_desc: Use image node_id 1 to create a new PreResUnit object from inherited base classes: nn with example: obj = PreResUnit(in_channels, out_channels, stride, bottleneck, conv1_stride)