-
Notifications
You must be signed in to change notification settings - Fork 363
scatter reduce decomposition #3008
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
Changes from all commits
f1be9fe
cd7d682
485adf9
35f2b00
e0eda18
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,16 +6,17 @@ | |
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union | ||
|
||
import numpy as np | ||
import tensorrt as trt | ||
import torch | ||
from torch._subclasses.fake_tensor import FakeTensor | ||
from torch_tensorrt._Device import Device | ||
from torch_tensorrt._enums import dtype | ||
from torch_tensorrt._Input import Input | ||
from torch_tensorrt.dynamo import _defaults | ||
from torch_tensorrt.dynamo._defaults import default_device | ||
from torch_tensorrt.dynamo._engine_cache import BaseEngineCache | ||
from torch_tensorrt.dynamo._settings import CompilationSettings | ||
|
||
import tensorrt as trt | ||
from packaging import version | ||
|
||
from .types import TRTDataType | ||
|
@@ -186,11 +187,14 @@ def get_model_device(module: torch.fx.GraphModule) -> torch.device: | |
device = None | ||
for parameter in list(module.parameters()): | ||
if isinstance(parameter, (torch.nn.parameter.Parameter, torch.Tensor)): | ||
device = parameter.device | ||
break | ||
return parameter.device | ||
|
||
for buffer in list(module.buffers()): | ||
Comment on lines
+190
to
+192
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The buffer device overrides the parameter device here which shouldn't be the case. Check device of parameters first, if not found, use buffers. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nvm |
||
if isinstance(buffer, (torch.Tensor)): | ||
return buffer.device | ||
|
||
if device is None: | ||
device = torch.device("cpu") | ||
device = to_torch_device(default_device()) | ||
logger.warning( | ||
"Could not detect the device on which the model exists. Assuming the model is on CPU" | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a kwarg
include_self
in https://github.com/pytorch/pytorch/blob/bc1b8f094d24de27432f4c29f0729e85a6b5ba63/aten/src/ATen/native/native_functions.yaml#L8237. Is it intentionally not handled in our decomposition?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review! Most of the cases which I have seen is with
include_self = True
. Here we have the implementation with the default case. No particular reason, I could add cases withinclude_self = False
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
include_self=True
in the function arguments. And raise an error saying we don't support the case when user sets itFalse