Skip to content

Commit

Permalink
apply style
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminum committed Sep 4, 2024
1 parent 35ee51e commit 170b650
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 14 deletions.
4 changes: 2 additions & 2 deletions python/open3d/ml/tf/python/layers/neighbor_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]),
Expand Down
48 changes: 36 additions & 12 deletions python/test/ml_ops/test_sparseconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 170b650

Please sign in to comment.