This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: strangnedd with the parser
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Justin Hodder, eric.smith, stestagg
Priority: normal Keywords:

Created on 2020-07-19 07:14 by Justin Hodder, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pythos_parser_bug.ipynb Justin Hodder, 2020-07-19 07:14 Jypiter notebook that reproducs the bug
Messages (4)
msg373937 - (view) Author: Justin Hodder (Justin Hodder) Date: 2020-07-19 07:14
Here a colab that demostrates the bug
https://colab.research.google.com/drive/1OWSEoV7Wx-EBA_2IprNZoASNvXIky3iC?usp=sharing
++++the following code gives"received an invalid combination of arguments - got (Tensor, Tensor), but expected one of:" 
import torch
torch.nn.Linear(
torch.as_strided(torch.ones((4,6*5*5*70*10)),(4,6*5*5,10),(4,2,-1))
,torch.ones(10,6*5*6))
#(4,2,3),(2,3,1))
++++The following code gives "TypeError: ones(): argument 'size' (position 1) must be tuple of ints, not str import torch"
import torch
#torch.nn.Linear(
torch.as_strided(torch.ones((4,6*5*5*70*10)),(4,6*5*5,10),(4,2,-1))
,torch.ones(10,6*5*6)#)
#(4,2,3),(2,3,1))
++++
msg373949 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-07-19 10:02
This doesn't appear to be a Python bug, but rather an issue with how you're using PyTorch. I suggest you ask for help on a PyTorch support forum, or maybe try StackOverflow.
msg374069 - (view) Author: Steve Stagg (stestagg) Date: 2020-07-21 15:53
This appears to be a bug with the google colab site.

For whatever reason, if you try to evaluate a statement that is a line with  a leading comma (afaik, never valid python), then colab does something wierd by wrapping the arguments in quotes, and evaluating them ...

Here, `>>>` denotes running python in a colab cell:

>>> type(1)
int
>>> ,type(1)
str
>>> ,type(1,2,3)
str
>>> ,type(1, 2, 3)
---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

<ipython-input-38-a1b277d7db3e> in <module>()
----> 1 type("(1,", "2,", "3)")

TypeError: type.__new__() argument 2 must be tuple, not str

---

This is not reproducible in normal python, so seems extremely likely to be some (planned or unplanned) feature of google colab that's causing confusion here.
msg374072 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-07-21 16:05
I'm going to close this as not a python bug. If someone gets some evidence to the contrary, we can re-open it.
History
Date User Action Args
2022-04-11 14:59:33adminsetgithub: 85509
2020-07-21 16:05:47eric.smithsetstatus: open -> closed
type: behavior
messages: + msg374072

resolution: not a bug
stage: resolved
2020-07-21 15:53:11stestaggsetstatus: pending -> open
nosy: + stestagg
messages: + msg374069

2020-07-19 10:02:32eric.smithsetstatus: open -> pending
nosy: + eric.smith
messages: + msg373949

2020-07-19 07:14:14Justin Hoddercreate