question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

2D Tensor Support

See original GitHub issue

The transforms in your package are incredibly useful and unique, but for my project I need to apply them on 2D images.

I can likely develop a work-around using the 3D transforms, however I saw on issue #22 and issue #53 that you have previously discussed implementing 2D image support and have since closed these issues. Despite these issues being marked resolved, when using the transforms with the tensor support method (as outlined in #139 ), I get the following error:

RuntimeError: The input tensor must have 4 dimensions (channels, i, j, k), but has 3: torch.Size([1, 120, 384])

This was from trying to feed a tensor with shape (channels, i, j). This error makes it seem like the transforms are still only for 3D inputs? I have tried this with a variety of the transforms and get the same results.

Is there a method I’m missing for applying your transforms with 2D images? Thanks so much in advance for any help you can offer.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
jillianleecommented, May 23, 2020

These all work perfectly for me! Thank you so much!

I don’t need any more transforms for 2D, but thank you though. This helps a lot, I really appreciate your work!

0reactions
Chao86commented, Sep 2, 2021

@romainVala has already replied to you in #643 (comment), please don’t post the same here, in a closed issue. If you find something is not working as you expected, you can open a new issue and follow the instructions: https://github.com/fepegar/torchio/issues/new?assignees=&labels=&template=not_working.md&title=

Sorry , I will refresh to browse the coomment https://github.com/fepegar/torchio/discussions/643#discussioncomment-1270113. Thank you for reminding me!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Two-Dimensional Tensors in Pytorch
Let's demonstrate by converting a 2D list of integers to a 2D tensor object. As an example, we'll create a 2D list and...
Read more >
Introduction to Tensors | TensorFlow Core
Tensors are multi-dimensional arrays with a uniform type (called a dtype ). You can see all supported dtypes at tf.dtypes.DType . If you're...
Read more >
PyTorch Two Dimensional Tensor | 2D Tensor - javatpoint
Two-dimensional tensor is similar to the two-dimensional metrics. A two-dimensional metrics have n number of rows and n number of columns.
Read more >
What is a 2D float tensor? - Stack Overflow
2D float tensor = 2D float matrix. FYI: The meaning of tensors in the neural network community.
Read more >
Tensor Explained with Python Numpy Examples - Data Analytics
A 2D tensor is a matrix, and a 3D tensor is an array of matrices. ... Here is what you learned about tensors...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found