Skip to content
Snippets Groups Projects
Verified Commit d833b7bd authored by Justin Carpentier's avatar Justin Carpentier
Browse files

core: remove TensorBase

parent 2215ca51
No related branches found
No related tags found
No related merge requests found
Pipeline #25968 failed
......@@ -342,11 +342,8 @@ struct eigen_allocator_impl_tensor {
tensor)
/// \brief Copy Python array into the input matrix mat.
template <typename TensorDerived, int AccessLevel>
static void copy(
const Eigen::TensorBase<TensorDerived, AccessLevel> &tensor_) {
TensorDerived &tensor = const_cast<TensorDerived &>(
static_cast<const TensorDerived &>(tensor_));
template <typename TensorDerived>
static void copy(PyArrayObject *pyArray, TensorDerived &tensor) {
const int pyArray_type_code = EIGENPY_GET_PY_ARRAY_TYPE(pyArray);
const int Scalar_type_code = Register::getTypeCode<Scalar>();
......
......@@ -78,8 +78,8 @@ struct numpy_allocator_impl<const TensorType,
template <typename TensorType>
struct numpy_allocator_impl_tensor {
template <typename TensorDerived>
static PyArrayObject *allocate(const Eigen::TensorBase<TensorDerived> &tensor,
npy_intp nd, npy_intp *shape) {
static PyArrayObject *allocate(const TensorDerived &tensor, npy_intp nd,
npy_intp *shape) {
const int code = Register::getTypeCode<typename TensorDerived::Scalar>();
PyArrayObject *pyArray = (PyArrayObject *)call_PyArray_SimpleNew(
static_cast<int>(nd), shape, code);
......@@ -250,10 +250,7 @@ struct numpy_allocator_impl_tensor<Eigen::TensorRef<TensorType> > {
return pyArray;
} else {
return NumpyAllocator<TensorType>::allocate(
static_cast<Eigen::TensorBase<Eigen::TensorRef<TensorType> > &>(
tensor),
nd, shape);
return NumpyAllocator<TensorType>::allocate(tensor, nd, shape);
}
}
};
......@@ -281,11 +278,7 @@ struct numpy_allocator_impl_tensor<const Eigen::TensorRef<const TensorType> > {
return pyArray;
} else {
return NumpyAllocator<TensorType>::allocate(
static_cast<
const Eigen::TensorBase<Eigen::TensorRef<const TensorType> > &>(
tensor),
nd, shape);
return NumpyAllocator<TensorType>::allocate(tensor, nd, shape);
}
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment