-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Add default parameters for Scala NDArray.arange #13816
Conversation
@lanking520 @piyushghai - Can you please help review this PR? |
@kiendang Thanks for your contributions. Can you push an empty commit to re-trigger the CI ?
|
* @param ctx Device context. Default context is the current default context. | ||
* @param dType The data type of the `NDArray`. The default datatype is `DType.Float32`. | ||
* @return NDArray of evenly spaced values in the specified range. | ||
*/ | ||
def arange(start: Float, stop: Option[Float], step: Float, | ||
repeat: Int, ctx: Context, dType: DType): NDArray = { | ||
def arange(start: Float, stop: Option[Float] = None, step: Float = 1.0f, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless you are certain that this param is not going to be used, please place it at the end of the param list and rename it as inferRange follows Java camel case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not being used now. Do you mean we still include it now in case it'll be used later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to #12064 (comment) infer_range
is only applicable to symbolic API and was meant to be removed from ndarray API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add @taliesinb here to bring more context since I am not very familiar with it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The infer_range change breaks python API.
@szha From my understanding @taliesinb could you verify? |
@kiendang since the python interface was already released in previous versions, any code that includes value for infer_range in the arange python will be broken because of the removal. |
I doubt anyone would manually include Still I get your point. I will revert the change if you think it's best to do so. If noone uses |
Thanks for the explanation. Since this option never worked, I'd recommend setting the python default value for it to None, and having a warning for the option indicating that this option is deprecated and ignored if it gets set to True or False (or not None in general). |
Hmm tests finished and passed but status wasn't updated here. |
@kiendang this is a known issue and @marcoabreu is working on it |
What are the next steps on this PR? |
Nothing more to add from me. |
@szha Could you please look into the updated PR and review/merge? |
@szha May I know what's the holdup? I use |
* Add default arguments for arange * Remove redundant tag * Update test * Remove infer_range for python ndarray.arange * Update CONTRIBUTORS.md * Deprecate infer_range argument in ndarray.arange
* Add default arguments for arange * Remove redundant tag * Update test * Remove infer_range for python ndarray.arange * Update CONTRIBUTORS.md * Deprecate infer_range argument in ndarray.arange
* Add default arguments for arange * Remove redundant tag * Update test * Remove infer_range for python ndarray.arange * Update CONTRIBUTORS.md * Deprecate infer_range argument in ndarray.arange
Description
Currently
NDArray.arange
requires manually passing all parameters.Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Put back default parameters for
NDArray.arange
and update unit test.Comments
Probably due to #12064 where a lot of changes were made and at the end default parameters got omitted unintentionally, which wasn't caught by tests.