diff --git a/python_binding/data/pybind_Tensor.cpp b/python_binding/data/pybind_Tensor.cpp index d4d6edc9ca4d51eabe0665352997f5d5469bff74..73a55d46139435778308c8f066af3e8fc2e3256d 100644 --- a/python_binding/data/pybind_Tensor.cpp +++ b/python_binding/data/pybind_Tensor.cpp @@ -257,7 +257,7 @@ static void addScalarCtor(pyTensorClass& mTensor) { // though it is not merged: https://github.com/pybind/pybind11/pull/3544/. // Hence we use some helper functions defined above to try matching the different numpy scalar types. mTensor.def(py::init([](py::object obj, - const std::string backend="cpu") { + const std::string& backend = "cpu") { NativeValue native_val; DataType native_dtype; bool found = getScalarNativeVal(obj, &native_val, &native_dtype); @@ -283,7 +283,7 @@ static void addScalarCtor(pyTensorClass& mTensor) { template<typename T> void addArrayCtor(pyTensorClass& mTensor) { mTensor.def(py::init([](const py::array_t<T, py::array::c_style|py::array::forcecast> b, - const std::string backend = "cpu") { + const std::string& backend = "cpu") { /* Request a buffer descriptor from Python */ py::buffer_info info = b.request(); Tensor* newTensor = new Tensor();