anchor.diff:  
       ///Retruns the index of the maximum element in an ArrayND
       let maxPosition (inAry: ArrayNDHostT<single>) =
  -        let maxElem = inAry |> ArrayND.maxAxis 0
  -        let maxElem = Seq.head (ArrayND.allElems maxElem)
  +        let maxElem = inAry |> ArrayND.max |> ArrayND.value
           let pos = ArrayND.allElems inAry |> Seq.findIndex (fun elem -> elem = maxElem)
  -        ArrayNDHost.scalar (single pos)
  +        pos |> single |> ArrayNDHost.scalar
   
       ///Retruns the index of the maximum element alone one axis od an ArrayND
  -    let maxPositionAxis dim inAry= 
  +    let maxPositionAxis dim inAry = 
           ArrayND.axisReduce maxPosition dim inAry
  +
       let aryToHost (ary: ArrayNDT<single>) =
           match ary with
           | :?  ArrayNDCudaT<single> as predCuda -> 
  
positive.code:             tempAry
          else ary
  
      ///Calculates the number of errors in one batch             
      let batchClassificationErrors batchSize (modelPred: ArrayNDT<single> -> ArrayNDT<single>) (input:ArrayNDT<single>) (target:ArrayNDT<single>) =
          let inSize = input.Shape.[0]
          if inSize < batchSize then
              let input = broadcastWithZeros batchSize input
              let target = broadcastWithZeros batchSize target
              let predAry = (modelPred input)
              predAry.[inSize..batchSize - 1,Fill] <- target.[inSize..batchSize - 1,Fill]
  
              let pred = aryToHost predAry
              let targ = aryToHost target
              let predClass = maxPositionAxis 1 pred
              let targetClass = maxPositionAxis 1 targ
              let errors = ArrayND.map2TC (fun a b -> if a = b then 0.0f else 1.0f) predClass targetClass |> ArrayND.sum
              let err = Seq.head (ArrayND.allElems errors)
              err
          else
              let predAry = (modelPred input)
  
              let pred = aryToHost predAry
              let targ = aryToHost target
              let predClass = maxPositionAxis 1 pred
              let targetClass = maxPositionAxis 1 targ
              let errors = ArrayND.map2TC (fun a b -> if a = b then 0.0f else 1.0f) predClass targetClass |> ArrayND.sum
              let err = Seq.head (ArrayND.allElems errors)
              err
  
      ///Calculates the number of errors in one dataset
      let setClassificationErrors batchSize (modelPred: ArrayNDT<single> -> ArrayNDT<single>) (inSeq: seq<CsvLoader.CsvSample>) =
          let errs =  inSeq
                      |>Seq.map (fun {Input = inp;Target = trg} -> 
                          batchClassificationErrors batchSize modelPred inp  trg )
                      |>Seq.fold (fun acc elem -> acc + elem) 0.0f
          errs
  
      ///Calculates the fraction of errors for train-, validation- and test-dataset
      let classificationErrors batchSize (dataset:TrnValTst<CsvLoader.CsvSample>) (modelPred: ArrayNDT<single> -> ArrayNDT<single>) =
          let nTrnSmpls = dataset.Trn.NSamples
          let nValSmpls = dataset.Val.NSamples
          let nTstSmpls = dataset.Tst.NSamples
          let trnBatches = dataset.Trn.Batches batchSize 
          let valBatches = dataset.Val.Batches batchSize 
          let tstBatches = dataset.Tst.Batches batchSize 
          let trnError = setClassificationErrors batchSize modelPred trnBatches  / (single nTrnSmpls)
          let valError = setClassificationErrors batchSize modelPred valBatches  / (single nValSmpls)                
          let tstError = setClassificationErrors batchSize modelPred tstBatches  / (single nTstSmpls)
          trnError,valError,tstError
  
      ///classification on abalone dataset using a single GPTransfer Unit
  
negative.code:                                                 DumpPrefix         = None
                                                  MaxIters           = Some 300
                                                  }
          let trnErr,valErr,tstErr = classificationErrors  batchSize data pred_fun
          printfn "Classification errors before training:"
          printfn "Train Error = %f%%, Validation Error = %f%%, Test Error =%f%% " (trnErr*100.0f) (valErr*100.0f) (tstErr*100.0f)
          let result = Train.train trainable data trainCfg
          //printfn "Training Time: %A" sw.Elapsed
          
  