Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
90047b96
"src/git@developer.sourcefind.cn:tianlh/lightgbm-dcu.git" did not exist on "631e0a2a7bdd694a91f30378fb271d05ce438122"
Unverified
Commit
90047b96
authored
Dec 01, 2022
by
Omar Salman
Committed by
GitHub
Nov 30, 2022
Browse files
[python-package] prefix basic.convert_from_sliced_object with _ (#5613)
parent
ae0cd5df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
python-package/lightgbm/basic.py
python-package/lightgbm/basic.py
+3
-3
No files found.
python-package/lightgbm/basic.py
View file @
90047b96
...
...
@@ -501,7 +501,7 @@ FEATURE_IMPORTANCE_TYPE_MAPPER = {"split": C_API_FEATURE_IMPORTANCE_SPLIT,
"gain"
:
C_API_FEATURE_IMPORTANCE_GAIN
}
def
convert_from_sliced_object
(
data
):
def
_
convert_from_sliced_object
(
data
):
"""Fix the memory of multi-dimensional sliced object."""
if
isinstance
(
data
,
np
.
ndarray
)
and
isinstance
(
data
.
base
,
np
.
ndarray
):
if
not
data
.
flags
.
c_contiguous
:
...
...
@@ -516,7 +516,7 @@ def c_float_array(data):
if
_is_1d_list
(
data
):
data
=
np
.
array
(
data
,
copy
=
False
)
if
_is_numpy_1d_array
(
data
):
data
=
convert_from_sliced_object
(
data
)
data
=
_
convert_from_sliced_object
(
data
)
assert
data
.
flags
.
c_contiguous
if
data
.
dtype
==
np
.
float32
:
ptr_data
=
data
.
ctypes
.
data_as
(
ctypes
.
POINTER
(
ctypes
.
c_float
))
...
...
@@ -536,7 +536,7 @@ def c_int_array(data):
if
_is_1d_list
(
data
):
data
=
np
.
array
(
data
,
copy
=
False
)
if
_is_numpy_1d_array
(
data
):
data
=
convert_from_sliced_object
(
data
)
data
=
_
convert_from_sliced_object
(
data
)
assert
data
.
flags
.
c_contiguous
if
data
.
dtype
==
np
.
int32
:
ptr_data
=
data
.
ctypes
.
data_as
(
ctypes
.
POINTER
(
ctypes
.
c_int32
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment