diff --git a/include/eigenpy/eigen-allocator.hpp b/include/eigenpy/eigen-allocator.hpp
index a9b8dc28254b9ff2490c026e06ce1ab455b861cf..edf89dd5747fff21d948e4e7b4986c363f419792 100644
--- a/include/eigenpy/eigen-allocator.hpp
+++ b/include/eigenpy/eigen-allocator.hpp
@@ -342,9 +342,10 @@ struct eigen_allocator_impl_tensor {
       tensor)
 
   /// \brief Copy Python array into the input matrix mat.
-  template <typename TensorDerived>
-  static void copy(PyArrayObject *pyArray,
-                   const Eigen::TensorBase<TensorDerived> &tensor_) {
+  template <typename TensorDerived, int AccessLevel>
+  static void copy(
+      PyArrayObject *pyArray,
+      const Eigen::TensorBase<TensorDerived, AccessLevel> &tensor_) {
     TensorDerived &tensor = const_cast<TensorDerived &>(
         static_cast<const TensorDerived &>(tensor_));
     const int pyArray_type_code = EIGENPY_GET_PY_ARRAY_TYPE(pyArray);