-
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 #3988
Fix Python formatting #3988
Conversation
!build |
CI MESSAGE: [5089788]: BUILD STARTED |
@@ -166,7 +172,9 @@ def define_graph(self): | |||
|
|||
def test_multiple_input_valid_shapes(): | |||
for batch in [1, 10]: | |||
for shapes in [None, (None, None), ((batch, 200, 200, 3), None), (None, (batch, 1)), (None, (batch,))]: | |||
for shapes in [ | |||
None, (None, None), ((batch, 200, 200, 3), None), (None, (batch, 1)), (None, (batch,)) |
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.
Actually, given the number of commas and braces:
None, (None, None), ((batch, 200, 200, 3), None), (None, (batch, 1)), (None, (batch,)) | |
None, | |
(None, None), | |
((batch, 200, 200, 3), None), | |
(None, (batch, 1)), | |
(None, (batch,)) |
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
for shape in [(None, None, None, None), (None, None, 2), (batch, None, None, None), | ||
(batch, None, 2)]: | ||
for shape in [ | ||
(None, None, None, None), (None, None, 2), (batch, None, None, None), (batch, None, 2) |
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.
(None, None, None, None), (None, None, 2), (batch, None, None, None), (batch, None, 2) | |
(None, None, None, None), | |
(None, None, 2), | |
(batch, None, None, None), | |
(batch, None, 2) |
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
yield raises(TypeError, expected_msg)(dali_pipe_deprecated), {"shapes": 2}, 2, tf.uint8, \ | ||
dali_types.UINT8, 1, 2 |
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.
yield raises(TypeError, expected_msg)(dali_pipe_deprecated), {"shapes": 2}, 2, tf.uint8, \ | |
dali_types.UINT8, 1, 2 | |
yield raises(TypeError, expected_msg)(dali_pipe_deprecated), \ | |
{"shapes": 2}, 2, tf.uint8, dali_types.UINT8, 1, 2 |
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
data = generate_data(31, 13, custom_shape_generator(3, 7, 160, 200, 80, 100, 3, 3), lo=0, | ||
hi=255, dtype=np.uint8) |
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.
data = generate_data(31, 13, custom_shape_generator(3, 7, 160, 200, 80, 100, 3, 3), lo=0, | |
hi=255, dtype=np.uint8) | |
data = generate_data(31, 13, custom_shape_generator(3, 7, 160, 200, 80, 100, 3, 3), | |
lo=0, hi=255, dtype=np.uint8) |
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
CI MESSAGE: [5089788]: BUILD FAILED |
'batch_processing': True, 'devices': ['cpu'], 'in_types': [types.UINT8], | ||
'ins_ndim': [3], 'out_types': [types.UINT8], 'outs_ndim': [3], |
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.
'batch_processing': True, 'devices': ['cpu'], 'in_types': [types.UINT8], | |
'ins_ndim': [3], 'out_types': [types.UINT8], 'outs_ndim': [3], | |
'batch_processing': True, 'devices': ['cpu'], | |
'in_types': [types.UINT8], 'ins_ndim': [3], | |
'out_types': [types.UINT8], 'outs_ndim': [3], |
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
'batch_processing': False, 'devices': ['cpu'], 'in_types': [types.UINT8], | ||
'ins_ndim': [3], 'out_types': [types.UINT8], 'outs_ndim': [3], |
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.
'batch_processing': False, 'devices': ['cpu'], 'in_types': [types.UINT8], | |
'ins_ndim': [3], 'out_types': [types.UINT8], 'outs_ndim': [3], | |
'batch_processing': False, 'devices': ['cpu'], | |
'in_types': [types.UINT8], 'ins_ndim': [3], | |
'out_types': [types.UINT8], 'outs_ndim': [3], |
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
rois = [ | ||
("HWC", (60, 80, 3), "HW", (4, 10), (40, 50), (4 / 60.0, 10 / 80.0), (40 / 60.0, 50 / 80.0), | ||
0), | ||
("HWC", (60, 80, 3), "HW", (4, 10), (40, 50), (4 / 60.0, 10 / 80.0), (40 / 60.0, 50 / 80.0), | ||
-1), | ||
("HWC", (60, 80, 3), "HW", (4, 10), (40, 50), (4 / 60.0, 10 / 80.0), (40 / 60.0, 50 / 80.0), | ||
(118, 186, 0)), | ||
("HWC", (60, 80, 3), "HW", (4, 2, 3, 4), (50, 10, 10, 50), | ||
(4 / 60.0, 2 / 80.0, 3 / 60.0, 4 / 80.0), (50 / 60.0, 10 / 80.0, 10 / 60.0, 50 / 80.0), 0), | ||
("HWC", (60, 80, 3), "H", (4, ), (7, ), (4 / 60.0, ), (7 / 60.0, ), 0), | ||
("DHWC", (10, 60, 80, 3), "DHW", (2, 4, 10), (5, 40, 50), (2 / 10.0, 4 / 60.0, 10 / 80.0), | ||
(5 / 10.0, 40 / 60.0, 50 / 80.0), 0), | ||
("HWC", (60, 80, 1), "WH", (10, 4), (50, 40), (10 / 80.0, 4 / 60.0), (50 / 80.0, 40 / 60.0), | ||
0), | ||
("XYZ", (60, 80, 3), "X", (4, ), (7, ), (4 / 60.0, ), (7 / 60.0, ), -10), |
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.
This is terrible - I'd recommend reverting and adding #noqa
or formatting by hand, e.g:
rois = [ | |
("HWC", (60, 80, 3), "HW", (4, 10), (40, 50), (4 / 60.0, 10 / 80.0), (40 / 60.0, 50 / 80.0), | |
0), | |
("HWC", (60, 80, 3), "HW", (4, 10), (40, 50), (4 / 60.0, 10 / 80.0), (40 / 60.0, 50 / 80.0), | |
-1), | |
("HWC", (60, 80, 3), "HW", (4, 10), (40, 50), (4 / 60.0, 10 / 80.0), (40 / 60.0, 50 / 80.0), | |
(118, 186, 0)), | |
("HWC", (60, 80, 3), "HW", (4, 2, 3, 4), (50, 10, 10, 50), | |
(4 / 60.0, 2 / 80.0, 3 / 60.0, 4 / 80.0), (50 / 60.0, 10 / 80.0, 10 / 60.0, 50 / 80.0), 0), | |
("HWC", (60, 80, 3), "H", (4, ), (7, ), (4 / 60.0, ), (7 / 60.0, ), 0), | |
("DHWC", (10, 60, 80, 3), "DHW", (2, 4, 10), (5, 40, 50), (2 / 10.0, 4 / 60.0, 10 / 80.0), | |
(5 / 10.0, 40 / 60.0, 50 / 80.0), 0), | |
("HWC", (60, 80, 1), "WH", (10, 4), (50, 40), (10 / 80.0, 4 / 60.0), (50 / 80.0, 40 / 60.0), | |
0), | |
("XYZ", (60, 80, 3), "X", (4, ), (7, ), (4 / 60.0, ), (7 / 60.0, ), -10), | |
rois = [ | |
("HWC", (60, 80, 3), "HW", (4, 10), (40, 50), | |
(4 / 60.0, 10 / 80.0), (40 / 60.0, 50 / 80.0), 0), | |
("HWC", (60, 80, 3), "HW", (4, 10), (40, 50), | |
(4 / 60.0, 10 / 80.0), (40 / 60.0, 50 / 80.0), -1), | |
("HWC", (60, 80, 3), "HW", (4, 10), (40, 50), | |
(4 / 60.0, 10 / 80.0), (40 / 60.0, 50 / 80.0), (118, 186, 0)), | |
("HWC", (60, 80, 3), "HW", (4, 2, 3, 4), (50, 10, 10, 50), | |
(4 / 60.0, 2 / 80.0, 3 / 60.0, 4 / 80.0), (50 / 60.0, 10 / 80.0, 10 / 60.0, 50 / 80.0), 0), | |
("HWC", (60, 80, 3), "H", (4, ), (7, ), (4 / 60.0, ), (7 / 60.0, ), 0), | |
("DHWC", (10, 60, 80, 3), "DHW", (2, 4, 10), (5, 40, 50), | |
(2 / 10.0, 4 / 60.0, 10 / 80.0), (5 / 10.0, 40 / 60.0, 50 / 80.0), 0), | |
("HWC", (60, 80, 1), "WH", (10, 4), (50, 40), | |
(10 / 80.0, 4 / 60.0), (50 / 80.0, 40 / 60.0), 0), | |
("XYZ", (60, 80, 3), "X", (4, ), (7, ), (4 / 60.0, ), (7 / 60.0, ), -10), |
for (input_layout, input_shape, axis_names, anchor, shape, anchor_norm, | ||
shape_norm, fill_value) in rois: |
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.
for (input_layout, input_shape, axis_names, anchor, shape, anchor_norm, | |
shape_norm, fill_value) in rois: | |
for (input_layout, input_shape, axis_names, anchor, shape, | |
anchor_norm, shape_norm, fill_value) in rois: |
input_shape, anchor, shape, axis_names, input_layout, anchor_norm_arg, \ | ||
shape_norm_arg, normalized_anchor, normalized_shape |
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.
input_shape, anchor, shape, axis_names, input_layout, anchor_norm_arg, \ | |
shape_norm_arg, normalized_anchor, normalized_shape | |
input_shape, anchor, shape, axis_names, input_layout, | |
anchor_norm_arg, shape_norm_arg, normalized_anchor, normalized_shape |
yield check_operator_erase_with_normalized_coords, device, batch_size, input_shape, anchor_arg,\ | ||
shape_arg, axis_names, input_layout, anchor_norm_arg, shape_norm_arg, True, True |
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.
yield check_operator_erase_with_normalized_coords, device, batch_size, input_shape, anchor_arg,\ | |
shape_arg, axis_names, input_layout, anchor_norm_arg, shape_norm_arg, True, True | |
yield (check_operator_erase_with_normalized_coords, | |
device, | |
batch_size, | |
input_shape, | |
anchor_arg, | |
shape_arg, | |
axis_names, | |
input_layout, | |
anchor_norm_arg, | |
shape_norm_arg, | |
True, | |
True) |
or
yield check_operator_erase_with_normalized_coords, device, batch_size, input_shape, anchor_arg,\ | |
shape_arg, axis_names, input_layout, anchor_norm_arg, shape_norm_arg, True, True | |
yield (check_operator_erase_with_normalized_coords, | |
device, batch_size, | |
input_shape, | |
anchor_arg, shape_arg, | |
axis_names, input_layout, | |
anchor_norm_arg, shape_norm_arg, | |
True, True) |
ref = np.array([[1, 2, 3, 4, 13, 14, 15], | ||
[5, 6, 7, 8, 16, 17, 18], | ||
[9, 10, 11, 12, 19, 20, 21]]) |
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.
Would that be ok? I wanted this to be aligned in columns.
ref = np.array([[1, 2, 3, 4, 13, 14, 15], | |
[5, 6, 7, 8, 16, 17, 18], | |
[9, 10, 11, 12, 19, 20, 21]]) | |
ref = np.array([[1, 2, 3, 4, 13, 14, 15], | |
[5, 6, 7, 8, 16, 17, 18], | |
[9, 10, 11, 12, 19, 20, 21]]) |
ref = np.array([[1, 2, 3, 4, 13, 14, 15], | ||
[5, 6, 7, 8, 16, 17, 18], | ||
[9, 10, 11, 12, 19, 20, 21]]) |
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.
ref = np.array([[1, 2, 3, 4, 13, 14, 15], | |
[5, 6, 7, 8, 16, 17, 18], | |
[9, 10, 11, 12, 19, 20, 21]]) | |
ref = np.array([[1, 2, 3, 4, 13, 14, 15], | |
[5, 6, 7, 8, 16, 17, 18], | |
[9, 10, 11, 12, 19, 20, 21]]) |
@@ -82,108 +84,110 @@ def test_cuda_array_interface_tensor_gpu(): | |||
pipe.build() | |||
tensor_list = pipe.run()[0] | |||
assert tensor_list[0].__cuda_array_interface__['data'][0] == tensor_list[0].data_ptr() | |||
assert tensor_list[0].__cuda_array_interface__['data'][1] == True | |||
assert tensor_list[0].__cuda_array_interface__['data'][1] is True |
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.
assert tensor_list[0].__cuda_array_interface__['data'][1] is True | |
assert tensor_list[0].__cuda_array_interface__['data'][1] |
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.
As far as I understand, the 'data' is expected to be a tuple of integer and boolean, so when choosing on how to fix I leant to a check that does not rely on implicit conversion to bool
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.
👍
exclude = re.compile(exclude) | ||
methods = [x for x in methods if not exclude.match(x)] | ||
# we are fine with covering more we can easily list, like numba | ||
assert set(methods).difference(set(tested_methods)) == set(), "Test doesn't cover:\n {}".format(set(methods) - set(tested_methods)) | ||
assert set(methods).difference(set(tested_methods)) == set(), "Test doesn't cover:\n {}".format( |
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.
might be personal preference. I'd have broken the line before the string
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
anchor_norm_arg = ( | ||
4 / 60.0, 10 / 80.0, 2000, 2000, 10 / 60.0, 4 / 80.0 | ||
) # second region is completely out of bounds |
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.
Personal preference: I'd put the comment in the previous line and keep the tuple definition in one line
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
for dct_type, norm, axis, n_mfcc, lifter, shape, msg in [ | ||
# DCT-I ortho-normalization is not supported | ||
(1, True, 0, 20, 0.0, (100, 100), | ||
"Ortho-normalization is not supported for DCT type I"), | ||
# axis out of bounds | ||
(2, False, -1, 20, 0.0, (100, 100), "Provided axis cannot be negative"), | ||
# axis out of bounds | ||
(2, False, 2, 20, 0.0, (100, 100), "Axis [\\d]+ is out of bounds \\[[\\d]+,[\\d]+\\)"), | ||
# not supported DCT type | ||
(10, False, 0, 20, 0.0, (100, 100), | ||
"Unsupported DCT type: 10. Supported types are: 1, 2, 3, 4"), | ||
]: |
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'd aim for some consistency here (e.g. move the error message to the next line always)
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
assert(True) | ||
except BaseException: | ||
assert(False) | ||
lazy_pipe.build() |
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.
missing assert_raises
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.
The example above had different order of asserts, I think this one was meant to simply pass (as opposed to the one above that should raise).
dali/test/python/test_pipeline.py
Outdated
out1 = as_cpu(out[0]).at(i) | ||
out2 = as_cpu(out[1]).at(i) | ||
out3 = as_cpu(out[2]).at(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.
Consider test_utils.as_array(out[0][i])
. You wouldn't need as_cpu
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.
Cool, thanks!
dali/test/python/test_pipeline.py
Outdated
out1 = out[0].as_cpu().at(i) if isinstance(out[0][0], dali.backend_impl.TensorGPU) else out[0].at(i) | ||
out2 = out[1].as_cpu().at(i) if isinstance(out[1][0], dali.backend_impl.TensorGPU) else out[1].at(i) | ||
out3 = out[2].as_cpu().at(i) if isinstance(out[2][0], dali.backend_impl.TensorGPU) else out[2].at(i) | ||
out1 = as_cpu(out[0]).at(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.
Consider test_utils.as_array
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
@@ -1656,42 +1701,42 @@ def test_preserve_arg(): | |||
pipe = dali.Pipeline(1, 1, 0) | |||
with pipe: | |||
out = dali.fn.external_source(source=[[np.array([-0.5, 1.25])]], preserve=True) | |||
res = dali.fn.resize(out, preserve=True) | |||
res = dali.fn.resize(out, preserve=True) # 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.
out of curiosity. What's the problem 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.
Oh, maybe it is silly: the test checks preservation of unused operators if preserve is set to True. So the linter complains about unused variable. I could very well just call resize and not assign the result to any variable, but wanted to preserve this more "canonical" look of defining the pipeline, after all the variable is unused intentionally.
assert pipe.exec_pipelined is True | ||
assert pipe.exec_async is True | ||
assert pipe.set_affinity is True |
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.
assert pipe.exec_pipelined is True | |
assert pipe.exec_async is True | |
assert pipe.set_affinity is True | |
assert pipe.exec_pipelined is True | |
assert pipe.exec_async is True | |
assert pipe.set_affinity is True |
assert pipe.exec_pipelined is True | |
assert pipe.exec_async is True | |
assert pipe.set_affinity is True | |
assert pipe.exec_pipelined | |
assert pipe.exec_async | |
assert pipe.set_affinity |
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.
Again, I wanted this check to enforce the type of the attribute (to be boolean). I can't be sure that it was an initial intention of the author, but explicit comparison to True literal here made me think so. And it is an attribute of the object we define, so maybe we should test that its type does not unexpectedly change from boolean to something that is accidentally true-ish.
assert pipe.max_streams == -1 | ||
assert pipe.prefetch_queue_depth == {"cpu_size": 3, "gpu_size": 2} | ||
assert pipe.cpu_queue_size == 3 | ||
assert pipe.gpu_queue_size == 2 | ||
assert pipe.py_num_workers == 3 | ||
assert pipe.py_start_method == "fork" | ||
assert pipe.enable_memory_stats == False | ||
assert pipe.enable_memory_stats is False |
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.
assert pipe.enable_memory_stats is False | |
assert not pipe.enable_memory_stats |
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.
Same concern as above.
bboxes = [ | ||
np.random.random(size=test_box_shape).astype(dtype=np.float32) | ||
for _ in range(batch_size)] |
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 that it reads better that an opening brace on a new line is matched with a closing brace on its own line:
bboxes = [ | |
np.random.random(size=test_box_shape).astype(dtype=np.float32) | |
for _ in range(batch_size)] | |
bboxes = [ | |
np.random.random(size=test_box_shape).astype(dtype=np.float32) | |
for _ in range(batch_size) | |
] |
TBH, I don't even know if the standard allows this.
This should be legal and within length limit:
bboxes = [ | |
np.random.random(size=test_box_shape).astype(dtype=np.float32) | |
for _ in range(batch_size)] | |
bboxes = [np.random.random(size=test_box_shape).astype(dtype=np.float32) | |
for _ in range(batch_size)] |
Anyway, these are just suggestions - I won't push 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.
Maybe it's weird personal preference: line break on opening of list comprehension leaves a whole line for the expression inside and highlights it nicely, while there is no similar reason for doing so with the closing bracket. Contrary, it weirdly separates the whole comprehension from the block of code it rests in. Anyway, here it perfectly fits with no break, so I reverted the change.
data = [ | ||
np.random.randint(0, 255, size=test_data_shape, dtype=np.uint8) | ||
for _ in range(batch_size)] | ||
bboxes = [ | ||
np.random.random(size=test_box_shape).astype(dtype=np.float32) | ||
for _ in range(batch_size)] | ||
labels = [ | ||
np.random.randint(0, 255, size=test_lables_shape, dtype=np.int32) | ||
for _ in range(batch_size)] |
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, too.
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
bboxes = [ | ||
np.random.random(size=test_box_shape).astype(dtype=np.float32) | ||
for _ in range(batch_size)] | ||
labels = [ | ||
np.random.randint(0, 255, size=test_lables_shape, dtype=np.int32) | ||
for _ in range(batch_size)] |
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.
...likewise...
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
[[1, 2, 3, 4], | ||
[5, 6, 7, 8], | ||
[9,10,11,12]])) | ||
[9, 10, 11, 12]])) |
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.
Can you keep column alignment?
[[1, 2, 3, 4], | |
[5, 6, 7, 8], | |
[9,10,11,12]])) | |
[9, 10, 11, 12]])) | |
[[1, 2, 3, 4], | |
[5, 6, 7, 8], | |
[9, 10, 11, 12]])) |
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
(fn.random.uniform(range=(0, 2), shape=(2, ), dtype=types.INT32), None, | ||
fn.random.uniform(range=(7, 10), shape=(2, ), | ||
dtype=types.INT32), None, None, None, (0, 1), None), | ||
(fn.random.uniform(range=(0, 2), shape=(1, ), dtype=types.INT32), None, | ||
fn.random.uniform(range=(7, 10), shape=(1, ), | ||
dtype=types.INT32), None, None, None, (1, ), None), | ||
(None, fn.random.uniform(range=(0.0, 0.2), shape=(1, )), None, | ||
fn.random.uniform(range=(0.8, 1.0), shape=(1, )), None, None, (1, ), None), |
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.
(fn.random.uniform(range=(0, 2), shape=(2, ), dtype=types.INT32), None, | |
fn.random.uniform(range=(7, 10), shape=(2, ), | |
dtype=types.INT32), None, None, None, (0, 1), None), | |
(fn.random.uniform(range=(0, 2), shape=(1, ), dtype=types.INT32), None, | |
fn.random.uniform(range=(7, 10), shape=(1, ), | |
dtype=types.INT32), None, None, None, (1, ), None), | |
(None, fn.random.uniform(range=(0.0, 0.2), shape=(1, )), None, | |
fn.random.uniform(range=(0.8, 1.0), shape=(1, )), None, None, (1, ), None), | |
(fn.random.uniform(range=(0, 2), shape=(2, ), dtype=types.INT32), None, | |
fn.random.uniform(range=(7, 10), shape=(2, ), dtype=types.INT32), | |
None, None, None, (0, 1), None), | |
(fn.random.uniform(range=(0, 2), shape=(1, ), dtype=types.INT32), None, | |
fn.random.uniform(range=(7, 10), shape=(1, ), dtype=types.INT32), | |
None, None, None, (1, ), None), | |
(None, fn.random.uniform(range=(0.0, 0.2), shape=(1, )), None, | |
fn.random.uniform(range=(0.8, 1.0), shape=(1, )), None, None, (1, ), None), |
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 _testimpl_numpy_reader_roi_error(file_root, batch_size, ndim, dtype, device, | ||
fortran_order=False, file_filter="*.npy", roi_start=None, | ||
rel_roi_start=None, roi_end=None, rel_roi_end=None, | ||
roi_shape=None, rel_roi_shape=None, roi_axes=None, | ||
out_of_bounds_policy=None, fill_value=None): |
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.
def _testimpl_numpy_reader_roi_error(file_root, batch_size, ndim, dtype, device, | |
fortran_order=False, file_filter="*.npy", roi_start=None, | |
rel_roi_start=None, roi_end=None, rel_roi_end=None, | |
roi_shape=None, rel_roi_shape=None, roi_axes=None, | |
out_of_bounds_policy=None, fill_value=None): | |
def _testimpl_numpy_reader_roi_error(file_root, batch_size, ndim, dtype, device, | |
fortran_order=False, file_filter="*.npy", | |
roi_start=None, rel_roi_start=None, | |
roi_end=None, rel_roi_end=None, | |
roi_shape=None, rel_roi_shape=None, | |
roi_axes=None, | |
out_of_bounds_policy=None, fill_value=None): |
...or just put each one in a separate line
@@ -47,7 +45,7 @@ def __init__(self, data_type): | |||
super().__init__(data_type) | |||
self._data = [ | |||
[ | |||
np.array([ 1, 2, 3, 4], dtype=self._data_type), | |||
np.array([1, 2, 3, 4], dtype=self._data_type), |
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.
np.array([1, 2, 3, 4], dtype=self._data_type), | |
np.array([ 1, 2, 3, 4], dtype=self._data_type), |
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.
Linter complains about leading space after [
. I decided on aligning the remaining columns to the right while leaving the first one aligned to the left.
np.array([[ 13, 23, 22], [ 23, 21, 14]], dtype=self._data_type), | ||
np.array([[ 23, 3, 6], [ 7, 0, 20]], dtype=self._data_type) | ||
np.array([[13, 23, 22], [23, 21, 14]], dtype=self._data_type), | ||
np.array([[23, 3, 6], [7, 0, 20]], dtype=self._data_type) |
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.
np.array([[23, 3, 6], [7, 0, 20]], dtype=self._data_type) | |
np.array([[23, 3, 6], [ 7, 0, 20]], dtype=self._data_type) |
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.
same as above
np.uint8, np.int8, np.uint16, np.int16, np.uint32, np.int32, | ||
np.uint64, np.int64, np.float32 |
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.
when we're at it....
np.uint8, np.int8, np.uint16, np.int16, np.uint32, np.int32, | |
np.uint64, np.int64, np.float32 | |
np.uint8, np.int8, | |
np.uint16, np.int16, | |
np.uint32, np.int32, | |
np.uint64, np.int64, | |
np.float32 |
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
np.uint8, np.int8, np.uint16, np.int16, np.uint32, np.int32, | ||
np.uint64, np.int64, np.float32 |
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.
np.uint8, np.int8, np.uint16, np.int16, np.uint32, np.int32, | |
np.uint64, np.int64, np.float32 | |
np.uint8, np.int8, | |
np.uint16, np.int16, | |
np.uint32, np.int32, | |
np.uint64, np.int64, | |
np.float32 |
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
dali/test/python/test_pipeline.py
Outdated
for reader_type in { | ||
"readers.MXNet", "readers.Caffe", "readers.Caffe2", "readers.File", "readers.TFRecord", | ||
"readers.Webdataset" | ||
}: |
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.
Likewise
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
dali/test/python/test_pipeline.py
Outdated
for reader_type in { | ||
"readers.MXNet", "readers.Caffe", "readers.Caffe2", "readers.File", "readers.Webdataset" | ||
}: |
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
dali/test/python/test_pipeline.py
Outdated
out1 = as_array(out[0].at(i)) | ||
out2 = as_array(out[1].at(i)) | ||
out3 = as_array(out[2].at(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.
When using as_array, you should use out[0][i]
out1 = as_array(out[0].at(i)) | |
out2 = as_array(out[1].at(i)) | |
out3 = as_array(out[2].at(i)) | |
out1 = as_array(out[0][i]) | |
out2 = as_array(out[1][i]) | |
out3 = as_array(out[2][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.
Sure, thanks!
dali/test/python/test_pipeline.py
Outdated
out1 = as_array(out[0].at(i)) | ||
out2 = as_array(out[1].at(i)) | ||
out3 = as_array(out[2].at(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.
out1 = as_array(out[0].at(i)) | |
out2 = as_array(out[1].at(i)) | |
out3 = as_array(out[2].at(i)) | |
out1 = as_array(out[0][i]) | |
out2 = as_array(out[1][i]) | |
out3 = as_array(out[2][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.
done
[[1, 2, 3, 4], | ||
[5, 6, 7, 8], | ||
[9, 10, 11, 12]])) |
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.
Normally, numbers are aligned to the right or to the decimal point.
[[1, 2, 3, 4], | |
[5, 6, 7, 8], | |
[9, 10, 11, 12]])) | |
[[1, 2, 3, 4], | |
[5, 6, 7, 8], | |
[9, 10, 11, 12]])) |
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
ref = np.array([[1, 2, 3, 4, 13, 14, 15], | ||
[5, 6, 7, 8, 16, 17, 18], | ||
[9, 10, 11, 12, 19, 20, 21]]) |
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.
ref = np.array([[1, 2, 3, 4, 13, 14, 15], | |
[5, 6, 7, 8, 16, 17, 18], | |
[9, 10, 11, 12, 19, 20, 21]]) | |
ref = np.array([[1, 2, 3, 4, 13, 14, 15], | |
[5, 6, 7, 8, 16, 17, 18], | |
[9, 10, 11, 12, 19, 20, 21]]) |
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
sequence_length=sequence_length, shard_id=0, | ||
num_shards=num_shards, random_shuffle=shuffle, |
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.
sequence_length=sequence_length, shard_id=0, | |
num_shards=num_shards, random_shuffle=shuffle, | |
sequence_length=sequence_length, | |
shard_id=0, num_shards=num_shards, | |
random_shuffle=shuffle, |
...or just go with 1 argument per line
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
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
b6eca99
to
43fcc80
Compare
!build |
CI MESSAGE: [5137810]: BUILD STARTED |
CI MESSAGE: [5137810]: BUILD PASSED |
Category:
Other (e.g. Documentation, Tests, Configuration)
Description:
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: DALI-2823