From 170b65027244f6fa431602628d6c96b030b7b6e6 Mon Sep 17 00:00:00 2001 From: Benjamin Ummenhofer Date: Wed, 4 Sep 2024 09:41:21 +0200 Subject: [PATCH] apply style --- .../ml/tf/python/layers/neighbor_search.py | 4 +- python/test/ml_ops/test_sparseconv.py | 48 ++++++++++++++----- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/python/open3d/ml/tf/python/layers/neighbor_search.py b/python/open3d/ml/tf/python/layers/neighbor_search.py index d66b28fcf32..d13dd799d11 100644 --- a/python/open3d/ml/tf/python/layers/neighbor_search.py +++ b/python/open3d/ml/tf/python/layers/neighbor_search.py @@ -122,9 +122,9 @@ def call(self, queries = queries.values if isinstance(radius, tf.Tensor): - radius_ = tf.cast(radius, points.dtype) + radius_ = tf.cast(radius, points.dtype) else: - radius_ = radius + radius_ = radius if points_row_splits is None: points_row_splits = tf.cast(tf.stack([0, tf.shape(points)[0]]), diff --git a/python/test/ml_ops/test_sparseconv.py b/python/test/ml_ops/test_sparseconv.py index 93bd8b53f3a..71a019ccc50 100644 --- a/python/test/ml_ops/test_sparseconv.py +++ b/python/test/ml_ops/test_sparseconv.py @@ -89,9 +89,15 @@ def bias_initializer(a): if ml.module.__name__ == 'torch': sparse_conv.to(ml.device) - y = mltest.run_op(ml, ml.device, True, sparse_conv, inp_features, - inp_positions * voxel_size, out_positions * voxel_size, - voxel_size=voxel_size, inp_importance=inp_importance) + y = mltest.run_op(ml, + ml.device, + True, + sparse_conv, + inp_features, + inp_positions * voxel_size, + out_positions * voxel_size, + voxel_size=voxel_size, + inp_importance=inp_importance) # Compare the output to a standard 3d conv # store features in a volume to use standard 3d convs @@ -210,9 +216,15 @@ def test_compare_to_conv3d_batches(ml, dtype, kernel_size, out_channels, inp_features = tf.RaggedTensor.from_row_splits( values=inp_features, row_splits=inp_positions_row_splits) - y = mltest.run_op(ml, ml.device, True, sparse_conv, inp_features, - inp_positions * voxel_size, out_positions * voxel_size, - voxel_size=voxel_size, inp_importance=inp_importance) + y = mltest.run_op(ml, + ml.device, + True, + sparse_conv, + inp_features, + inp_positions * voxel_size, + out_positions * voxel_size, + voxel_size=voxel_size, + inp_importance=inp_importance) for idx in range(batch_size): inp_pos = inp_positions[idx].numpy() inp_feat = inp_features[idx].numpy() @@ -336,9 +348,15 @@ def bias_initializer(a): if ml.module.__name__ == 'torch': sparse_conv_transpose.to(ml.device) - y = mltest.run_op(ml, ml.device, True, sparse_conv_transpose, inp_features, - inp_positions * voxel_size, out_positions * voxel_size, - voxel_size=voxel_size, out_importance=out_importance) + y = mltest.run_op(ml, + ml.device, + True, + sparse_conv_transpose, + inp_features, + inp_positions * voxel_size, + out_positions * voxel_size, + voxel_size=voxel_size, + out_importance=out_importance) # Compare the output to a standard 3d conv # store features in a volume to use standard 3d convs @@ -463,9 +481,15 @@ def test_compare_to_conv3dtranspose_batches(ml, dtype, kernel_size, inp_features = tf.RaggedTensor.from_row_splits( values=inp_features, row_splits=inp_positions_row_splits) - y = mltest.run_op(ml, ml.device, True, sparse_conv_transpose, inp_features, - inp_positions * voxel_size, out_positions * voxel_size, - voxel_size=voxel_size, out_importance=out_importance) + y = mltest.run_op(ml, + ml.device, + True, + sparse_conv_transpose, + inp_features, + inp_positions * voxel_size, + out_positions * voxel_size, + voxel_size=voxel_size, + out_importance=out_importance) for idx in range(batch_size): inp_pos = inp_positions[idx].numpy() inp_feat = inp_features[idx].numpy()