Fix #4163: always copy sliced data (#4165)

* Revert "Accept numpy array view. (#4147)"

This reverts commit a985a99cf0.

* Fix #4163: always copy sliced data

* Remove print() from the test; check shape equality

* Check if 'base' attribute exists

* Fix lint

* Address reviewer comment

* Fix lint
This commit is contained in:
Philip Hyunsu Cho
2019-02-20 14:46:34 -08:00
committed by GitHub
parent cecbe0cf71
commit 2aaae2e7bb
6 changed files with 76 additions and 146 deletions

View File

@@ -1,5 +1,5 @@
/*!
* Copyright (c) 2015-2019 by Contributors
* Copyright (c) 2015 by Contributors
* \file c_api.h
* \author Tianqi Chen
* \brief C API of XGBoost, used for interfacing to other languages.
@@ -283,23 +283,6 @@ XGB_DLL int XGDMatrixSetFloatInfo(DMatrixHandle handle,
const char *field,
const float *array,
bst_ulong len);
/*!
* \brief `XGDMatrixSetFloatInfo' with strided array as input.
*
* \param handle a instance of data matrix
* \param field field name, can be label, weight
* \param array pointer to float vector
* \param stride stride of input vector
* \param len length of array
*
* \return 0 when success, -1 when failure happens
*/
XGB_DLL int XGDMatrixSetFloatInfoStrided(DMatrixHandle handle,
const char *field,
const float *array,
const bst_ulong stride,
bst_ulong len);
/*!
* \brief set uint32 vector to a content in info
* \param handle a instance of data matrix
@@ -312,23 +295,6 @@ XGB_DLL int XGDMatrixSetUIntInfo(DMatrixHandle handle,
const char *field,
const unsigned *array,
bst_ulong len);
/*!
* \brief `XGDMatrixSetUIntInfo' with strided array as input.
*
* \param handle a instance of data matrix
* \param field field name
* \param array pointer to unsigned int vector
* \param stride stride of input vector
* \param len length of array
*
* \return 0 when success, -1 when failure happens
*/
XGB_DLL int XGDMatrixSetUIntInfoStrided(DMatrixHandle handle,
const char *field,
const unsigned *array,
const bst_ulong stride,
bst_ulong len);
/*!
* \brief set label of the training matrix
* \param handle a instance of data matrix

View File

@@ -122,7 +122,6 @@ class MetaInfo {
* \param num Number of elements in the source array.
*/
void SetInfo(const char* key, const void* dptr, DataType dtype, size_t num);
void SetInfo(const char* key, const void* dptr, DataType dtype, size_t stride, size_t num);
private:
/*! \brief argsort of labels */