-
Notifications
You must be signed in to change notification settings - Fork 607
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
Fix Python formatting #3992
Fix Python formatting #3992
Conversation
Signed-off-by: szalpal <mszolucha@nvidia.com>
Signed-off-by: szalpal <mszolucha@nvidia.com>
Signed-off-by: szalpal <mszolucha@nvidia.com>
!build |
CI MESSAGE: [5111600]: BUILD STARTED |
Signed-off-by: szalpal <mszolucha@nvidia.com>
CI MESSAGE: [5111600]: BUILD PASSED |
L1 tests pass |
Signed-off-by: szalpal <mszolucha@nvidia.com>
@@ -33,20 +29,15 @@ def get_min_shape_helper(batch, max_shape): | |||
`batch` can also be a string "dataset" that indicates we passed a Dataset object as input | |||
without specifying the batch mode through: Input(dataset, batch=...) | |||
""" | |||
if batch is None or batch == True: | |||
if batch is None or batch == True: # noqa: E712 |
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.
I think is True
would be fine here (1. would not change how the function works on actual inputs and 2. would not trigger the linter)
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.
Done
@@ -143,36 +134,38 @@ def to_dataset(pipeline_desc, device_str): | |||
|
|||
with tf.device('/cpu:0'): | |||
input_dataset = tf.data.Dataset.from_tensors(tensor).repeat() | |||
if batch is None or batch == True: | |||
if batch is None or batch == True: # noqa: E712 |
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.
and here
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.
Done
@@ -184,50 +177,46 @@ def to_dataset(pipeline_desc, device_str): | |||
tf_type = tf.dtypes.as_dtype(dtype) | |||
input_dataset = tf.data.Dataset.from_generator( | |||
input_iterator, output_types=tf_type, output_shapes=out_shape, args=_args) | |||
if batch is None or batch == True: | |||
if batch is None or batch == True: # noqa: E712 |
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.
and here
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.
Done
if batch is None or batch == True: | ||
InfiniteSampleIterator, output_types=tf_type, output_shapes=shape, | ||
args=(value,)) | ||
if batch is None or batch == True: # noqa: E712 |
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.
and here
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.
Done
|
||
|
||
def test_numba_func_cpu(): | ||
def set_all_values_to_255_batch(out0, in0): | ||
out0[0][:] = 255 | ||
|
||
def setup_out_shape(out_shape, in_shape): | ||
out_shape = in_shape | ||
out_shape = in_shape # noqa: F841 |
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 may be out of scope, but this assignment does seem to do nothing indeed. I wonder if the intention was more like out_shape[i] = in_shape[i]
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.
Changed to pass
, as this is a no-op statement.
@@ -72,11 +70,13 @@ def _compare_to_cv_distortion(in_img, out_img, q, no): | |||
decoded_img = cv2.cvtColor(decoded_img_bgr, cv2.COLOR_BGR2RGB) | |||
|
|||
diff = cv2.absdiff(out_img, decoded_img) | |||
diff_in_range = np.average(diff) < 5, f"Absolute difference with the reference is too big: {np.average(diff)}" | |||
diff_in_range = np.average( | |||
diff) < 5, f"Absolute difference with the reference is too big: {np.average(diff)}" |
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.
Isn't this piece of code broken?
diff_in_range
is a pair, thus it is always true-ish and the assert never fails and does not actually enforce the np.average(diff) < 5
condition.
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 string after comma looks like some leftover from assert
being there previously. Got rid of the string.
!build |
CI MESSAGE: [5138994]: BUILD STARTED |
CI MESSAGE: [5138994]: BUILD PASSED |
L1 tests pass |
Category:
Refactoring (Redesign of existing code that doesn't affect functionality)
Description:
Fix Python formatting.
TODO:
Additional information:
Affected modules and functionalities:
Key points relevant for the review:
Tests:
Checklist
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: N/A