anchor.diff:          let kernelDepth = kernelSize.[0]
           let kernelHeight = kernelSize.[1]
           let kernelWidth = kernelSize.[2]
  -        let inputDepthAfterPadding = inputDepth + 2*padding.[0]
  -        let inputHeightAfterPadding = inputHeight + 2*padding.[1]
  -        let inputWidthAfterPadding = inputWidth + 2*padding.[2]
  +        let inputDepthAfterPadding = inputDepth + 2*paddings.[0]
  +        let inputHeightAfterPadding = inputHeight + 2*paddings.[1]
  +        let inputWidthAfterPadding = inputWidth + 2*paddings.[2]
           if kernelSize.[0] > inputDepthAfterPadding then failwithf "Expecting kernelSize.[0] (%A) <= inputDepthAfterPadding (%A)" kernelSize.[0] inputDepthAfterPadding
           if kernelSize.[1] > inputHeightAfterPadding then failwithf "Expecting kernelSize.[1] (%A) <= inputHeightAfterPadding (%A)" kernelSize.[1] inputHeightAfterPadding
           if kernelSize.[2] > inputWidthAfterPadding then failwithf "Expecting kernelSize.[1] (%A) <= inputWidthAfterPadding (%A)" kernelSize.[1] inputWidthAfterPadding
  -        let outputDepth = int (floor (float (inputDepth + 2*padding.[0] - kernelDepth)/(float stride.[0]))) + 1
  -        let outputHeight = int (floor (float (inputHeight + 2*padding.[1] - kernelHeight)/(float stride.[1]))) + 1
  -        let outputWidth = int (floor (float (inputWidth + 2*padding.[2] - kernelWidth)/(float stride.[2]))) + 1
  +        let outputDepth = int (floor (float (inputDepth + 2*paddings.[0] - kernelDepth)/(float strides.[0]))) + 1
  +        let outputHeight = int (floor (float (inputHeight + 2*paddings.[1] - kernelHeight)/(float strides.[1]))) + 1
  +        let outputWidth = int (floor (float (inputWidth + 2*paddings.[2] - kernelWidth)/(float strides.[2]))) + 1
           let outputShape = [|batchSize; channels; outputDepth; outputHeight; outputWidth|]
           (batchSize, channels, (inputDepth, inputHeight, inputWidth), (kernelDepth, kernelHeight, kernelWidth), (outputDepth, outputHeight, outputWidth), outputShape)
   
  
positive.code:         let kernelDepth = shape2.[2]
          let kernelHeight = shape2.[3]
          let kernelWidth = shape2.[4]
          let inputDepthAfterPadding = inputDepth + 2*padding.[0]
          let inputHeightAfterPadding = inputHeight + 2*padding.[1]
          let inputWidthAfterPadding = inputWidth + 2*padding.[2]
          if filtersChannels <> inputChannels then failwithf "Input and filters have different number of channels: %A, %A" inputChannels filtersChannels
          if kernelDepth > inputDepthAfterPadding then failwithf "Expecting kernelDepth (%A) <= inputDepthAfterPadding (%A)" kernelDepth inputDepthAfterPadding
          if kernelHeight > inputHeightAfterPadding then failwithf "Expecting kernelHeight (%A) <= inputHeightAfterPadding (%A)" kernelHeight inputHeightAfterPadding
          if kernelWidth > inputWidthAfterPadding then failwithf "Expecting kernelWidth (%A) <= inputWidthAfterPadding (%A)" kernelWidth inputWidthAfterPadding
          let outputDepth = int (floor (float (inputDepthAfterPadding - kernelDepth)/(float stride.[0]))) + 1
          let outputHeight = int (floor (float (inputHeightAfterPadding - kernelHeight)/(float stride.[1]))) + 1
          let outputWidth = int (floor (float (inputWidthAfterPadding - kernelWidth)/(float stride.[2]))) + 1
          let outputShape = [|batchSize; outputChannels; outputDepth; outputHeight; outputWidth|]
          batchSize, inputChannels, (kernelDepth, kernelHeight, kernelWidth), (outputChannels, outputDepth, outputHeight, outputWidth), outputShape
  
  
negative.code:         batchSize, channels, inputSize, outputSize, outputShape
  
      /// Checks if the given shapes are appropriate for a maxpool operation and returns information related to the resulting shape.
      let checkCanMaxpool2d (dtype: Dtype) (shape: Shape) (kernelSize: int[]) (strides: int[]) (paddings: int[]) =
          match dtype with 
          | Dtype.Bool | Dtype.Integral -> opNotSupported "maxpool2d" dtype
          | _ ->
          if shape.Length <> 4 then failwithf "Expecting a 4d tensor (NxCxHxW: batchSize x inputChannels x inputHeight x inputWidth), received tensor with shape %A" shape
          if kernelSize.[0] < 1 || kernelSize.[1] < 1 then failwithf "Expecting all kernelSizes (%A) >= 1" kernelSize
          if paddings.[0] < 0 || paddings.[1] < 0 then failwithf "Expecting all paddings (%A) >= 0" paddings
          if paddings.[0] > kernelSize.[0]/2 || paddings.[1] > kernelSize.[1]/2 then failwithf "Expecting all paddings (%A) < kernelSizes (%A) / 2" paddings kernelSize
          if strides.[0] < 1 || strides.[1] < 1 then failwithf "Expecting all strides (%A) >= 1" strides
          let batchSize = shape.[0]
          let channels = shape.[1]
          let inputHeight = shape.[2]
          let inputWidth = shape.[3]
          let kernelHeight = kernelSize.[0]
          let kernelWidth = kernelSize.[1]
          let inputHeightAfterPadding = inputHeight + 2*paddings.[0]
          let inputWidthAfterPadding = inputWidth + 2*paddings.[1]
          if kernelSize.[0] > inputHeightAfterPadding then failwithf "Expecting kernelSize.[0] (%A) <= inputHeightAfterPadding (%A)" kernelSize.[0] inputHeightAfterPadding
          if kernelSize.[1] > inputWidthAfterPadding then failwithf "Expecting kernelSize.[1] (%A) <= inputWidthAfterPadding (%A)" kernelSize.[1] inputWidthAfterPadding
          let outputHeight = int (floor (float (inputHeight + 2*paddings.[0] - kernelHeight)/(float strides.[0]))) + 1
          let outputWidth = int (floor (float (inputWidth + 2*paddings.[1] - kernelWidth)/(float strides.[1]))) + 1
          let outputShape = [|batchSize; channels; outputHeight; outputWidth|]
          (batchSize, channels, (inputHeight, inputWidth), (kernelHeight, kernelWidth), (outputHeight, outputWidth), outputShape)
  
      /// Checks if the given shapes are appropriate for a maxpool operation and returns information related to the resulting shape.
      let checkCanMaxpool3d (dtype: Dtype) (shape: Shape) (kernelSize: int[]) (strides: int[]) (paddings: int[]) =
          match dtype with 
          | Dtype.Bool | Dtype.Integral -> opNotSupported "maxpool3d" dtype
          | _ ->
          if shape.Length <> 5 then failwithf "Expecting a 5d tensor (NxCxDxHxW: batchSize x inputChannels x inputDepth x inputHeight x inputWidth), received tensor with shape %A" shape
          if kernelSize.[0] < 1 || kernelSize.[1] < 1 || kernelSize.[2] < 1 then failwithf "Expecting all kernelSizes (%A) >= 1" kernelSize
          if paddings.[0] < 0 || paddings.[1] < 0 || paddings.[2] < 0 then failwithf "Expecting all paddings (%A) >= 0" paddings
          if paddings.[0] > kernelSize.[0]/2 || paddings.[1] > kernelSize.[1]/2 || paddings.[2] > kernelSize.[2]/2 then failwithf "Expecting all paddings (%A) < kernelSizes (%A) / 2" paddings kernelSize
          if strides.[0] < 1 || strides.[1] < 1 || strides.[2] < 1 then failwithf "Expecting all strides (%A) >= 1" strides
          let batchSize = shape.[0]
          let channels = shape.[1]
          let inputDepth = shape.[2]
  