Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added writeable input data array feature for benchopt #213

Merged
merged 2 commits into from
Mar 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion modopt/opt/gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class GradParent(object):
Method for calculating the cost (default is ``None``)
data_type : type, optional
Expected data type of the input data (default is ``None``)
input_data_writeable: bool, optional
Option to make the observed data writeable (default is ``False``)
verbose : bool, optional
Option for verbose output (default is ``True``)

Expand Down Expand Up @@ -66,10 +68,12 @@ def __init__(
get_grad=None,
cost=None,
data_type=None,
input_data_writeable=False,
verbose=True,
):

self.verbose = verbose
self._input_data_writeable = input_data_writeable
self._grad_data_type = data_type
self.obs_data = input_data
self.op = op
Expand Down Expand Up @@ -102,7 +106,7 @@ def obs_data(self, input_data):
check_npndarray(
input_data,
dtype=self._grad_data_type,
writeable=False,
writeable=self._input_data_writeable,
verbose=self.verbose,
)

Expand Down