Skip to content
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

Backend/pytorch arrays #1660

Open
wants to merge 9 commits into
base: backend/pytorch-arrays
Choose a base branch
from

Conversation

Emvlt
Copy link

@Emvlt Emvlt commented Oct 14, 2024

New interface with ASTRA using Link interface:

  1. New astra_cuda_link backend
  2. New Link Class
  3. PyTorch Autograd wrapper
  4. Test functions
  5. Benchmark package
  6. Adapted PyTest functions
  7. pytorch calls hotfixes
  8. Type hinting hotfixes

<!> Known issues:

  1. in-place does not work
  2. 2D does not work

@pep8speaks
Copy link

pep8speaks commented Oct 14, 2024

Checking updated PR...

Line 71:1: W391 blank line at end of file
Line 68:22: E231 missing whitespace after ','
Line 68:20: E231 missing whitespace after ','
Line 67:1: W293 blank line contains whitespace
Line 59:15: E225 missing whitespace around operator
Line 57:1: W293 blank line contains whitespace
Line 56:10: W291 trailing whitespace
Line 56:9: E123 closing bracket does not match indentation of opening bracket's line
Line 55:13: E251 unexpected spaces around keyword / parameter equals
Line 55:11: E251 unexpected spaces around keyword / parameter equals
Line 54:13: W291 trailing whitespace
Line 53:35: E262 inline comment should start with '# '
Line 53:34: E261 at least two spaces before inline comment
Line 51:9: E123 closing bracket does not match indentation of opening bracket's line
Line 49:30: W291 trailing whitespace
Line 49:17: E251 unexpected spaces around keyword / parameter equals
Line 49:15: E251 unexpected spaces around keyword / parameter equals
Line 48:31: W291 trailing whitespace
Line 48:15: E251 unexpected spaces around keyword / parameter equals
Line 48:13: E251 unexpected spaces around keyword / parameter equals
Line 46:1: W293 blank line contains whitespace
Line 45:54: E262 inline comment should start with '# '
Line 45:53: E261 at least two spaces before inline comment
Line 45:14: E231 missing whitespace after ':'
Line 45:13: E203 whitespace before ':'
Line 43:19: E221 multiple spaces before operator
Line 41:80: E501 line too long (81 > 79 characters)
Line 38:80: E501 line too long (83 > 79 characters)
Line 24:28: E231 missing whitespace after ','
Line 24:26: E231 missing whitespace after ','
Line 23:80: E501 line too long (92 > 79 characters)
Line 23:12: E203 whitespace before ':'
Line 20:13: E123 closing bracket does not match indentation of opening bracket's line
Line 17:45: W291 trailing whitespace
Line 17:14: E201 whitespace after '['
Line 16:45: W291 trailing whitespace
Line 16:13: E126 continuation line over-indented for hanging indent
Line 14:13: E221 multiple spaces before operator
Line 13:18: W291 trailing whitespace
Line 12:5: E266 too many leading '#' for block comment

Line 95:61: E251 unexpected spaces around keyword / parameter equals
Line 95:59: E251 unexpected spaces around keyword / parameter equals
Line 86:24: E221 multiple spaces before operator
Line 82:56: W291 trailing whitespace
Line 76:41: W291 trailing whitespace
Line 71:18: W291 trailing whitespace
Line 71:17: E123 closing bracket does not match indentation of opening bracket's line
Line 63:20: E203 whitespace before ':'
Line 62:20: E203 whitespace before ':'
Line 61:20: E203 whitespace before ':'
Line 60:20: E203 whitespace before ':'
Line 59:5: E303 too many blank lines (2)
Line 55:80: E501 line too long (87 > 79 characters)
Line 49:80: E501 line too long (93 > 79 characters)
Line 36:5: E266 too many leading '#' for block comment
Line 28:5: E266 too many leading '#' for block comment
Line 23:80: E501 line too long (94 > 79 characters)
Line 23:57: E251 unexpected spaces around keyword / parameter equals
Line 21:5: E266 too many leading '#' for block comment
Line 16:54: E251 unexpected spaces around keyword / parameter equals
Line 16:52: E251 unexpected spaces around keyword / parameter equals
Line 1:80: E501 line too long (87 > 79 characters)

Line 796:52: E262 inline comment should start with '# '
Line 796:51: E261 at least two spaces before inline comment
Line 791:52: E262 inline comment should start with '# '
Line 791:51: E261 at least two spaces before inline comment
Line 771:55: E262 inline comment should start with '# '
Line 771:54: E261 at least two spaces before inline comment
Line 743:80: E501 line too long (82 > 79 characters)
Line 743:71: E262 inline comment should start with '# '
Line 743:70: E261 at least two spaces before inline comment
Line 688:66: E262 inline comment should start with '# '
Line 688:65: E261 at least two spaces before inline comment
Line 609:61: E262 inline comment should start with '# '
Line 609:60: E261 at least two spaces before inline comment
Line 552:66: E262 inline comment should start with '# '
Line 552:65: E261 at least two spaces before inline comment
Line 431:38: E262 inline comment should start with '# '
Line 431:37: E261 at least two spaces before inline comment
Line 430:38: E262 inline comment should start with '# '
Line 430:37: E261 at least two spaces before inline comment
Line 427:80: E501 line too long (82 > 79 characters)
Line 427:71: E262 inline comment should start with '# '
Line 427:70: E261 at least two spaces before inline comment
Line 425:66: E262 inline comment should start with '# '
Line 425:65: E261 at least two spaces before inline comment
Line 382:68: E262 inline comment should start with '# '
Line 382:67: E261 at least two spaces before inline comment
Line 380:45: E262 inline comment should start with '# '
Line 380:44: E261 at least two spaces before inline comment
Line 379:43: E262 inline comment should start with '# '
Line 379:42: E261 at least two spaces before inline comment
Line 268:21: E123 closing bracket does not match indentation of opening bracket's line
Line 266:34: W291 trailing whitespace
Line 264:21: E123 closing bracket does not match indentation of opening bracket's line
Line 262:26: W291 trailing whitespace
Line 248:80: E501 line too long (82 > 79 characters)
Line 168:80: E501 line too long (105 > 79 characters)
Line 159:9: E123 closing bracket does not match indentation of opening bracket's line
Line 124:46: E261 at least two spaces before inline comment
Line 108:9: E123 closing bracket does not match indentation of opening bracket's line
Line 94:9: E122 continuation line missing indentation or outdented
Line 93:20: W291 trailing whitespace
Line 93:9: E122 continuation line missing indentation or outdented
Line 92:17: W291 trailing whitespace
Line 92:9: E122 continuation line missing indentation or outdented
Line 91:19: W291 trailing whitespace
Line 91:9: E122 continuation line missing indentation or outdented
Line 90:9: E131 continuation line unaligned for hanging indent
Line 51:5: E123 closing bracket does not match indentation of opening bracket's line
Line 49:14: W291 trailing whitespace
Line 48:16: W291 trailing whitespace
Line 47:13: W291 trailing whitespace
Line 46:15: W291 trailing whitespace
Line 42:9: E123 closing bracket does not match indentation of opening bracket's line
Line 34:9: E123 closing bracket does not match indentation of opening bracket's line

Line 2:26: W292 no newline at end of file

Line 45:5: E266 too many leading '#' for block comment
Line 39:32: W291 trailing whitespace
Line 38:14: W291 trailing whitespace
Line 31:81: E262 inline comment should start with '# '
Line 31:80: E501 line too long (92 > 79 characters)
Line 25:80: E501 line too long (80 > 79 characters)
Line 25:69: E262 inline comment should start with '# '
Line 25:68: E261 at least two spaces before inline comment
Line 22:9: E121 continuation line under-indented for hanging indent
Line 20:50: W291 trailing whitespace
Line 19:43: W291 trailing whitespace
Line 19:13: E126 continuation line over-indented for hanging indent
Line 16:9: E241 multiple spaces after ':'
Line 12:17: E203 whitespace before ':'
Line 11:5: E125 continuation line with same indent as next logical line
Line 11:5: E123 closing bracket does not match indentation of opening bracket's line
Line 10:19: E203 whitespace before ':'
Line 9:16: E241 multiple spaces after ':'
Line 9:14: E203 whitespace before ':'
Line 8:18: E241 multiple spaces after ':'
Line 8:16: E203 whitespace before ':'
Line 7:15: E231 missing whitespace after ':'
Line 6:1: E302 expected 2 blank lines, found 1

Line 76:10: W292 no newline at end of file
Line 76:9: E123 closing bracket does not match indentation of opening bracket's line
Line 64:42: W291 trailing whitespace
Line 63:15: E221 multiple spaces before operator
Line 62:1: W293 blank line contains whitespace
Line 60:1: W293 blank line contains whitespace
Line 58:39: E231 missing whitespace after ':'
Line 56:80: E501 line too long (88 > 79 characters)
Line 54:17: E123 closing bracket does not match indentation of opening bracket's line
Line 52:28: E231 missing whitespace after ':'
Line 51:38: W291 trailing whitespace
Line 51:24: E231 missing whitespace after ':'
Line 50:22: W291 trailing whitespace
Line 47:1: W293 blank line contains whitespace
Line 46:10: W291 trailing whitespace
Line 46:9: E123 closing bracket does not match indentation of opening bracket's line
Line 45:14: E251 unexpected spaces around keyword / parameter equals
Line 45:12: E251 unexpected spaces around keyword / parameter equals
Line 44:15: E251 unexpected spaces around keyword / parameter equals
Line 43:28: W291 trailing whitespace
Line 43:13: E251 unexpected spaces around keyword / parameter equals
Line 43:11: E251 unexpected spaces around keyword / parameter equals
Line 42:13: W291 trailing whitespace
Line 41:34: W291 trailing whitespace
Line 39:9: E123 closing bracket does not match indentation of opening bracket's line
Line 37:30: W291 trailing whitespace
Line 37:17: E251 unexpected spaces around keyword / parameter equals
Line 37:15: E251 unexpected spaces around keyword / parameter equals
Line 36:31: W291 trailing whitespace
Line 36:15: E251 unexpected spaces around keyword / parameter equals
Line 36:13: E251 unexpected spaces around keyword / parameter equals
Line 33:80: E501 line too long (91 > 79 characters)
Line 30:9: E121 continuation line under-indented for hanging indent
Line 28:50: W291 trailing whitespace
Line 27:43: W291 trailing whitespace
Line 27:13: E126 continuation line over-indented for hanging indent
Line 24:8: E221 multiple spaces before operator
Line 23:10: E231 missing whitespace after ':'
Line 22:10: E231 missing whitespace after ':'
Line 20:22: E221 multiple spaces before operator
Line 20:16: E203 whitespace before ':'
Line 19:16: E203 whitespace before ':'
Line 18:5: E125 continuation line with same indent as next logical line
Line 18:5: E123 closing bracket does not match indentation of opening bracket's line
Line 17:19: E203 whitespace before ':'
Line 16:16: E241 multiple spaces after ':'
Line 16:14: E203 whitespace before ':'
Line 15:18: E241 multiple spaces after ':'
Line 15:16: E203 whitespace before ':'
Line 14:15: E231 missing whitespace after ':'
Line 13:1: E302 expected 2 blank lines, found 1
Line 11:16: E226 missing whitespace around arithmetic operator
Line 10:49: E231 missing whitespace after ':'
Line 10:28: E231 missing whitespace after ':'
Line 9:1: W293 blank line contains whitespace

Line 37:12: W292 no newline at end of file
Line 35:27: E231 missing whitespace after ','
Line 35:25: E231 missing whitespace after ','
Line 30:26: E231 missing whitespace after ','
Line 30:24: E231 missing whitespace after ','

Line 74:10: W292 no newline at end of file
Line 68:50: E262 inline comment should start with '# '
Line 68:49: E261 at least two spaces before inline comment
Line 65:50: E262 inline comment should start with '# '
Line 65:49: E261 at least two spaces before inline comment
Line 60:13: E123 closing bracket does not match indentation of opening bracket's line
Line 56:35: E231 missing whitespace after ':'
Line 51:32: E231 missing whitespace after ':'
Line 49:1: E302 expected 2 blank lines, found 1
Line 46:1: W293 blank line contains whitespace
Line 44:80: E501 line too long (93 > 79 characters)
Line 43:1: W293 blank line contains whitespace
Line 42:80: E501 line too long (118 > 79 characters)
Line 36:80: E501 line too long (82 > 79 characters)
Line 36:69: E261 at least two spaces before inline comment
Line 35:80: E501 line too long (89 > 79 characters)
Line 33:96: E261 at least two spaces before inline comment
Line 33:80: E501 line too long (109 > 79 characters)
Line 32:1: W293 blank line contains whitespace
Line 31:27: E221 multiple spaces before operator
Line 30:25: E221 multiple spaces before operator
Line 26:9: E125 continuation line with same indent as next logical line
Line 26:9: E123 closing bracket does not match indentation of opening bracket's line
Line 25:27: W291 trailing whitespace
Line 25:17: E231 missing whitespace after ':'
Line 24:21: E231 missing whitespace after ':'
Line 23:13: W291 trailing whitespace
Line 20:1: E302 expected 2 blank lines, found 1

Line 688:13: E266 too many leading '#' for block comment
Line 678:17: E266 too many leading '#' for block comment

Line 1882:80: E501 line too long (80 > 79 characters)
Line 1856:80: E501 line too long (80 > 79 characters)
Line 1830:80: E501 line too long (82 > 79 characters)
Line 1560:1: E303 too many blank lines (3)
Line 1438:1: E303 too many blank lines (4)
Line 1422:31: E261 at least two spaces before inline comment
Line 849:46: E261 at least two spaces before inline comment
Line 848:80: E501 line too long (86 > 79 characters)
Line 848:73: E261 at least two spaces before inline comment
Line 737:80: E501 line too long (80 > 79 characters)
Line 556:26: E226 missing whitespace around arithmetic operator
Line 454:80: E501 line too long (85 > 79 characters)
Line 454:35: E127 continuation line over-indented for visual indent
Line 453:80: E501 line too long (81 > 79 characters)
Line 446:18: E126 continuation line over-indented for hanging indent
Line 433:16: E121 continuation line under-indented for hanging indent
Line 423:80: E501 line too long (85 > 79 characters)
Line 299:80: E501 line too long (87 > 79 characters)
Line 27:80: E501 line too long (81 > 79 characters)

Line 156:1: W391 blank line at end of file
Line 96:1: E302 expected 2 blank lines, found 1
Line 88:37: E262 inline comment should start with '# '
Line 88:36: E261 at least two spaces before inline comment
Line 86:65: W291 trailing whitespace
Line 81:80: E501 line too long (96 > 79 characters)
Line 80:80: E501 line too long (110 > 79 characters)
Line 71:80: E501 line too long (82 > 79 characters)
Line 45:1: E302 expected 2 blank lines, found 1
Line 27:80: E501 line too long (80 > 79 characters)
Line 24:80: E501 line too long (80 > 79 characters)

Line 300:1: E302 expected 2 blank lines, found 1
Line 291:9: E117 over-indented
Line 290:1: E302 expected 2 blank lines, found 1
Line 259:5: E303 too many blank lines (2)
Line 258:1: W293 blank line contains whitespace
Line 235:80: E501 line too long (92 > 79 characters)
Line 234:1: W293 blank line contains whitespace
Line 231:33: E231 missing whitespace after ','
Line 229:35: E231 missing whitespace after ','
Line 229:33: E231 missing whitespace after ','
Line 227:9: E266 too many leading '#' for block comment
Line 226:13: E123 closing bracket does not match indentation of opening bracket's line
Line 224:22: W291 trailing whitespace
Line 223:48: W291 trailing whitespace
Line 223:23: E231 missing whitespace after ':'
Line 222:18: W291 trailing whitespace
Line 219:80: E501 line too long (84 > 79 characters)
Line 214:38: W291 trailing whitespace
Line 210:13: E123 closing bracket does not match indentation of opening bracket's line
Line 208:19: W291 trailing whitespace
Line 207:19: W291 trailing whitespace
Line 204:1: W293 blank line contains whitespace
Line 197:80: E501 line too long (91 > 79 characters)
Line 191:33: E231 missing whitespace after ','
Line 189:35: E231 missing whitespace after ','
Line 189:33: E231 missing whitespace after ','
Line 187:9: E266 too many leading '#' for block comment
Line 186:13: E123 closing bracket does not match indentation of opening bracket's line
Line 184:44: W291 trailing whitespace
Line 184:19: E231 missing whitespace after ':'
Line 183:18: W291 trailing whitespace
Line 175:29: E221 multiple spaces before operator
Line 165:22: E221 multiple spaces before operator
Line 164:9: E303 too many blank lines (2)
Line 160:29: E221 multiple spaces before operator
Line 62:9: E125 continuation line with same indent as next logical line
Line 62:9: E121 continuation line under-indented for hanging indent
Line 61:23: E251 unexpected spaces around keyword / parameter equals
Line 61:21: E251 unexpected spaces around keyword / parameter equals
Line 60:41: W291 trailing whitespace
Line 60:23: E231 missing whitespace after ':'
Line 59:40: W291 trailing whitespace
Line 59:22: E231 missing whitespace after ':'
Line 58:31: W291 trailing whitespace
Line 58:21: E231 missing whitespace after ':'
Line 57:18: W291 trailing whitespace
Line 48:80: E501 line too long (89 > 79 characters)
Line 47:1: E302 expected 2 blank lines, found 1
Line 44:1: E302 expected 2 blank lines, found 1

Line 31:80: E501 line too long (102 > 79 characters)
Line 21:1: E302 expected 2 blank lines, found 1
Line 19:80: E501 line too long (81 > 79 characters)
Line 15:1: E302 expected 2 blank lines, found 1
Line 11:80: E501 line too long (82 > 79 characters)

Line 44:80: E501 line too long (87 > 79 characters)
Line 42:80: E501 line too long (87 > 79 characters)
Line 39:80: E501 line too long (86 > 79 characters)
Line 35:80: E501 line too long (84 > 79 characters)
Line 33:80: E501 line too long (108 > 79 characters)
Line 28:80: E501 line too long (81 > 79 characters)

Line 62:80: E501 line too long (89 > 79 characters)
Line 60:80: E501 line too long (111 > 79 characters)
Line 55:80: E501 line too long (91 > 79 characters)
Line 44:80: E501 line too long (95 > 79 characters)

Line 369:54: E262 inline comment should start with '# '
Line 369:54: E261 at least two spaces before inline comment
Line 321:60: E262 inline comment should start with '# '
Line 321:59: E261 at least two spaces before inline comment
Line 296:32: E262 inline comment should start with '# '
Line 296:31: E261 at least two spaces before inline comment
Line 130:38: E262 inline comment should start with '# '
Line 130:37: E261 at least two spaces before inline comment
Line 65:76: W291 trailing whitespace

Line 660:1: E302 expected 2 blank lines, found 1
Line 654:1: E302 expected 2 blank lines, found 1
Line 651:5: E301 expected 1 blank line, found 0
Line 649:5: E301 expected 1 blank line, found 0
Line 647:5: E301 expected 1 blank line, found 0
Line 645:5: E301 expected 1 blank line, found 0
Line 643:5: E301 expected 1 blank line, found 0
Line 640:1: E302 expected 2 blank lines, found 1
Line 637:5: E301 expected 1 blank line, found 0
Line 633:5: E301 expected 1 blank line, found 0
Line 632:42: E251 unexpected spaces around keyword / parameter equals
Line 632:40: E251 unexpected spaces around keyword / parameter equals
Line 631:5: E301 expected 1 blank line, found 0
Line 630:43: E251 unexpected spaces around keyword / parameter equals
Line 630:41: E251 unexpected spaces around keyword / parameter equals
Line 629:5: E301 expected 1 blank line, found 0
Line 628:46: E251 unexpected spaces around keyword / parameter equals
Line 628:44: E251 unexpected spaces around keyword / parameter equals
Line 623:55: E225 missing whitespace around operator
Line 621:47: E225 missing whitespace around operator
Line 617:5: E301 expected 1 blank line, found 0
Line 614:1: E302 expected 2 blank lines, found 1
Line 611:5: E301 expected 1 blank line, found 0
Line 609:5: E301 expected 1 blank line, found 0
Line 607:5: E301 expected 1 blank line, found 0
Line 605:5: E301 expected 1 blank line, found 0
Line 603:5: E301 expected 1 blank line, found 0
Line 600:1: E302 expected 2 blank lines, found 1
Line 591:1: E302 expected 2 blank lines, found 1
Line 586:36: E225 missing whitespace around operator
Line 583:1: E302 expected 2 blank lines, found 1
Line 573:1: E302 expected 2 blank lines, found 1
Line 566:37: E261 at least two spaces before inline comment
Line 552:1: E302 expected 2 blank lines, found 1
Line 546:20: E126 continuation line over-indented for hanging indent
Line 545:1: E305 expected 2 blank lines after class or function definition, found 1
Line 410:22: E201 whitespace after '('
Line 350:1: E303 too many blank lines (3)
Line 328:1: E302 expected 2 blank lines, found 1
Line 72:5: E123 closing bracket does not match indentation of opening bracket's line
Line 68:5: E123 closing bracket does not match indentation of opening bracket's line
Line 62:80: E501 line too long (83 > 79 characters)
Line 62:1: E266 too many leading '#' for block comment

Comment last updated at 2024-10-21 15:22:13 UTC

It needs to be possible to run ODL without Astra.
…ady on Torch.

The old `torch.tensor` converter did just the right thing: construct a new
tensor when given lists or NumPy arrays, and simply clone the input if it was
already a PyTorch tensor.
For some reason, Torch has deprecated this behaviour, so it is now necessary
to hard-code the different possibilities.
…TensorSpace objects.

This removes the necessity for some redundant checks/conversions.
Backend-specific arrays are used in several different places;
TensorSpace-element construction is only one of them.

N.B. this partly reverts the changes made in e0c85b0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants