Comments (2)
This problem is related a few changes.
#104689 has a fix in 2.1.0 for "Inplace tensor update on transpose" problem for HPU or other devices that doens't have support on non contiguous output.But this PR cause some issues in part of the code calling wrap_output_with_input_device_.
#119868 reverted part of the code of #104689 to fix the new issues in 2.3.0. So the original issue in #103650 reopens in 2.3.0
from pytorch.
There are cases that a FakeTensor is not reserve its fakeness when calling into convert_element_type.
For example, the following code run on CPU, the input FakeTensor is not preserved in output of type conversion in _to_copy decomposition for some calls.
import torch
def fn(a):
b = a.t()
b.mul_(1.0)
return b
x = torch.arange(6).reshape([2, 3]).to('cpu')
print("x ", x.cpu())
compiled_fn = torch.compile(fn)
y = compiled_fn(x)
print("y ", y.cpu())
_to_copy start: FakeTensor(..., device='meta', size=(3, 2), dtype=torch.int64)
after type converted: tensor(..., device='meta', size=(3, 2))
_to_copy start: FakeTensor(..., size=(3, 2))
after type converted: FakeTensor(..., size=(3, 2), dtype=torch.int64)
_to_copy start: FakeTensor(..., size=(3, 2))
after type converted: FakeTensor(..., size=(3, 2), dtype=torch.int64)
I found usually the convert_element_type_meta is called under the fake mode if necessary and torch.empty_strided in the TensorMeta function will return FakeTensor in such case. But I am not sure why the first call in the above case doesn't preserve the Fakeness (Is this itself a bug?)
I read through the discussions in #119868. There were a few proposals.
Is there any problem of the initial proposal of "checking the input and current type as the fakeness and call wrap_output_with_input_device only necessary"?
I think convert_element_type_meta is much more impactful if we want to give convert_element_type_meta the semantics of preserving fakeness. Please suggest.
from pytorch.
Related Issues (20)
- [torch.compile] Llama2 failure using dynamic shapes with Torch 2.4 nightly HOT 1
- DISABLED test_segfault (__main__.TestDataLoader) HOT 1
- aot_export_module produces unserializable GraphModules
- Dynamo graph breaks when passing a constant value to a nn module initialized within a function
- MaskedTensor do not support _is_any_true`
- internal asset failure HOT 1
- post grad batch linear fusion performs unsafe optimization when inlining nn modules HOT 3
- NotImplementedError: Could not run 'quantized::linear' with arguments from the 'CPU' backend. 'quantized::linear' is only available for these backends: [QuantizedCPU, QuantizedCUDA, BackendSelect, Python,....] HOT 1
- TorchScript JIT UnicodeDecodeError: βutf-8β codec canβt decode byte 0xe0 in position 0: unexpected end of data
- Lintrunner results inconsistent
- make AutocastPrivateUse1 have a default implement
- jacrev and jacfwd yield different results if one uses torch.no_grad blocks in module HOT 4
- Retry on CUBLAS_STATUS_ALLOC_FAILED HOT 1
- The running will become slower and slower with epoch continuing, but without error when the mlpmixer model is used HOT 2
- custom torch.autograd.Function with jvp method outputs error without explicit torch._dynamo import HOT 2
- [BUG] Circular dependency `torch.nn.parameter` -> `torch.nn` -> `torch.autograd` -> `torch._C._autograd_init()` -> `torch.nn.parameter`
- torch.onnx.export() 1.16 with pytorch 2.2.1 produces invalid model
- Saved variable packing unpacking incorrect aliases version counter
- CUDA causes ipykernel failure HOT 1
- Be able to dynamically disable a kernel for a custom op
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch.