# Cannot compute predictions using "double" only "float"

**URL:** <https://root-forum.cern.ch/t/cannot-compute-predictions-using-double-only-float/55410>\
**Category:** TMVA\
**Created:** [June 23, 2023, 10:53am UTC](https://root-forum.cern.ch/t/cannot-compute-predictions-using-double-only-float/55410 "2023-06-23T10:53:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chandler\_K](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/chandler_k/32/32906_2.png) [@Chandler\_K](https://root-forum.cern.ch/u/Chandler_K)\
**Post date:** [June 23, 2023, 10:53am UTC](https://root-forum.cern.ch/t/cannot-compute-predictions-using-double-only-float/55410/1 "2023-06-23T10:53:40Z")

</div>

I cannot generate predictions when I give the TMVA::Experiment::RBDT’s Compute() method an input of std::vector. Indeed, my code fails to compile in this case.

Working code:

```auto
TMVA::Experimental::RBDT<> *fBDT1;
fBDT1 = new TMVA::Experimental::RBDT<>(
    "my_bdt", "/path/to/my/model.root");
double prediction = fBDT1->Compute(GetInput())[0];

```

Where GetInput is defined as `std::vector<float> GetInput()`  
If I try to use `std::vector<double> GetInput()` instead my code fails to compile with the following message:

```auto
required from here
/cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.22.00-be0a0/x86_64-centos7-gcc8-opt/include/TMVA/RBDT.hxx:80:10: error: no matching function for call to ‘TMVA::Experimental::BranchlessJittedForest<float>::Inference(const value_type*, int, bool, __gnu_cxx::__ alloc_traits<std::allocator<double>, double>::value_type*)’
          fBackends[i].Inference(&x[0], 1, true, &y[i]);

/cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.22.00-be0a0/x86_64-centos7-gcc8-opt/include/TMVA/TreeInference/Forest.hxx:358:6: note: candidate: ‘void TMVA::Experimental::BranchlessJittedForest<T>::Inference(const T*, int, bool, T*) [with T = float]’
 void BranchlessJittedForest<T>::Inference(const T *inputs, const int rows, bool layout, T *predictions)
      ^ ~~~~~~~~~~~~~~~~~~~~~~~~
/cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.22.00-be0a0/x86_64-centos7-gcc8-opt/include/TMVA/TreeInference/Forest.hxx:358:6: note: no known conversion for argument 1 from ‘const value_type*’ {aka ‘const double*’} to ‘const float*’

```

Am I not able to use double’s as inputs, if so can this please be fixed?

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [June 23, 2023, 11:22am UTC](https://root-forum.cern.ch/t/cannot-compute-predictions-using-double-only-float/55410/2 "2023-06-23T11:22:14Z")

</div>

I guess @moneta can help you.
