Skip to content

Commit

Permalink
Adding verbose attribute to GradParent to solve issue #100 (#101)
Browse files Browse the repository at this point in the history
* Adding verbose attribute to GradParent to solve issue #100

* Improved the attribute docstring

* Fixed correct order of the attributes of GradParent.
  • Loading branch information
tobias-liaudat authored Jan 19, 2021
1 parent d2548ce commit c77eb32
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions modopt/opt/gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,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``)
verbose : bool, optional
Option for verbose output (default is ``True``)
Examples
--------
Expand All @@ -55,8 +57,9 @@ class GradParent(object):
"""

def __init__(self, data, op, trans_op, get_grad=None, cost=None,
data_type=None):
data_type=None, verbose=True):

self.verbose = verbose
self._grad_data_type = data_type
self.obs_data = data
self.op = op
Expand Down Expand Up @@ -85,7 +88,8 @@ def obs_data(self, data):

if self._grad_data_type in (float, np.floating):
data = check_float(data)
check_npndarray(data, dtype=self._grad_data_type, writeable=False)
check_npndarray(data, dtype=self._grad_data_type, writeable=False,
verbose=self.verbose)

self._obs_data = data

Expand Down

0 comments on commit c77eb32

Please sign in to comment.