Repository navigation
feat(label_tensor): add dim parameter to LabelTensor.stack method - #835
Conversation
|
Hi @s-chudmunge ! Thanks for submitting. Are you able to rebase from dev? I see some commits that are not labeltensor based from this PR after changing the destination merge branch |
dario-coscia
left a comment
There was a problem hiding this comment.
Hi, great job! I added a comment on the test for labeltensors to also check additional dimensions where the stack is performed. After that addition I think it will be good to go 👍🏻
| assert lt_stacked.full_labels[1]["name"] == "second" | ||
|
|
||
|
|
||
| def test_stack_dim(): |
There was a problem hiding this comment.
Can we make an extra test here to check all labels' dimensions and not just the last one?
GiovanniCanali
left a comment
There was a problem hiding this comment.
Thank you, @s-chudmunge, for contributing to PINA. The feature looks clean!
I agree with @dario-coscia’s suggestion: please rebase the branch onto dev so that the PR includes only the commits relevant to LabelTensor.
Also, consider adding tests covering higher-dimensional cases, similar to test_vstack_2D and test_vstack_3D.
4bb264d to
b49be15
Compare
|
Hi @dario-coscia @GiovanniCanali, Thanks for the feedback!
Please let me know if anything else is needed! |
GiovanniCanali
left a comment
There was a problem hiding this comment.
Thank you, @s-chudmunge, for addressing the minor issues discussed above. Everything looks good to me!
Resolves #770
Summary
Exposes the
dimparameter inLabelTensor.stack(tensors, dim=0)to align withtorch.stack.Key Changes
dim=0argument toLabelTensor.stackwith support for positive and negative dimension indices.[-(ndim + 1), ndim]matchingtorch.stack._labelsdimension indices by shifting indices at or afterdimby +1.tests/test_label_tensor/test_label_tensor.pycoveringdim=0,dim=1, and negative indexing.