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

empty_memory_format evaluator #2745

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

apbose
Copy link
Collaborator

@apbose apbose commented Apr 12, 2024

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant and/or add your own.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project (You can use the linters)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas and hacks
  • I have made corresponding changes to the documentation
  • I have added tests to verify my fix or my feature
  • New and existing unit tests pass locally with my changes
  • I have added the relevant labels to my PR in so that relevant reviewers are notified

@apbose apbose self-assigned this Apr 12, 2024
@apbose apbose marked this pull request as draft April 12, 2024 00:22
@github-actions github-actions bot added component: tests Issues re: Tests component: conversion Issues re: Conversion stage component: api [Python] Issues re: Python API component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels Apr 12, 2024
@github-actions github-actions bot requested a review from gs-olive April 12, 2024 00:23
@apbose apbose force-pushed the empty_memory_format_evaluator branch 2 times, most recently from ed97b61 to ad5b467 Compare May 24, 2024 00:12
@apbose apbose marked this pull request as ready for review May 24, 2024 00:13
@apbose apbose requested review from zewenli98 and chohk88 May 24, 2024 00:13
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some changes that do not conform to Python style guidelines:

--- /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/conversion/ops_evaluators.py	2024-05-24 00:12:59.638980+00:00
+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/conversion/ops_evaluators.py	2024-05-24 00:14:55.849732+00:00
@@ -87,10 +87,11 @@
    kwargs: Dict[str, Argument],
    name: str,
) -> Union[TRTTensor, Sequence[TRTTensor]]:
    return np.random.randn(*args[0])

+
def randperm_validator(randperm_node: Node) -> bool:
    dtype = randperm_node.kwargs.get("dtype", None)
    layout = randperm_node.kwargs.get("layout", None)
    input = randperm_node.args[0]
    if not isinstance(input, int):
@@ -116,10 +117,11 @@
    args: Tuple[Argument, ...],
    kwargs: Dict[str, Argument],
    name: str,
) -> Union[TRTTensor, Sequence[TRTTensor]]:
    return np.random.permutation(args[0])
+

def empty_validator(empty_node: Node) -> bool:
    layout = empty_node.kwargs.get("layout", None)
    pin_memory = empty_node.kwargs.get("pin_memory", None)
    memory_format = empty_node.kwargs.get("memory_format", None)
@@ -162,8 +164,5 @@
    elif memory_format == torch.channels_last_3d:
        # shape of args[0] must be 5
        empty_tensor = empty_tensor.to(memory_format=torch.channels_last_3d)

    return empty_tensor
-
-
-

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some changes that do not conform to Python style guidelines:

--- /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/conversion/ops_evaluators.py	2024-05-24 00:13:13.183345+00:00
+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/conversion/ops_evaluators.py	2024-05-24 00:15:09.256602+00:00
@@ -87,10 +87,11 @@
    kwargs: Dict[str, Argument],
    name: str,
) -> Union[TRTTensor, Sequence[TRTTensor]]:
    return np.random.randn(*args[0])

+
def randperm_validator(randperm_node: Node) -> bool:
    dtype = randperm_node.kwargs.get("dtype", None)
    layout = randperm_node.kwargs.get("layout", None)
    input = randperm_node.args[0]
    if not isinstance(input, int):
@@ -116,10 +117,11 @@
    args: Tuple[Argument, ...],
    kwargs: Dict[str, Argument],
    name: str,
) -> Union[TRTTensor, Sequence[TRTTensor]]:
    return np.random.permutation(args[0])
+

def empty_validator(empty_node: Node) -> bool:
    layout = empty_node.kwargs.get("layout", None)
    pin_memory = empty_node.kwargs.get("pin_memory", None)
    memory_format = empty_node.kwargs.get("memory_format", None)
@@ -162,8 +164,5 @@
    elif memory_format == torch.channels_last_3d:
        # shape of args[0] must be 5
        empty_tensor = empty_tensor.to(memory_format=torch.channels_last_3d)

    return empty_tensor
-
-
-

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some changes that do not conform to Python style guidelines:

--- /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/conversion/ops_evaluators.py	2024-05-24 00:13:23.345164+00:00
+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/conversion/ops_evaluators.py	2024-05-24 00:15:15.812085+00:00
@@ -87,10 +87,11 @@
    kwargs: Dict[str, Argument],
    name: str,
) -> Union[TRTTensor, Sequence[TRTTensor]]:
    return np.random.randn(*args[0])

+
def randperm_validator(randperm_node: Node) -> bool:
    dtype = randperm_node.kwargs.get("dtype", None)
    layout = randperm_node.kwargs.get("layout", None)
    input = randperm_node.args[0]
    if not isinstance(input, int):
@@ -116,10 +117,11 @@
    args: Tuple[Argument, ...],
    kwargs: Dict[str, Argument],
    name: str,
) -> Union[TRTTensor, Sequence[TRTTensor]]:
    return np.random.permutation(args[0])
+

def empty_validator(empty_node: Node) -> bool:
    layout = empty_node.kwargs.get("layout", None)
    pin_memory = empty_node.kwargs.get("pin_memory", None)
    memory_format = empty_node.kwargs.get("memory_format", None)
@@ -162,8 +164,5 @@
    elif memory_format == torch.channels_last_3d:
        # shape of args[0] must be 5
        empty_tensor = empty_tensor.to(memory_format=torch.channels_last_3d)

    return empty_tensor
-
-
-

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some changes that do not conform to Python style guidelines:

--- /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/conversion/ops_evaluators.py	2024-05-24 00:13:45.282455+00:00
+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/conversion/ops_evaluators.py	2024-05-24 00:15:36.375546+00:00
@@ -87,10 +87,11 @@
    kwargs: Dict[str, Argument],
    name: str,
) -> Union[TRTTensor, Sequence[TRTTensor]]:
    return np.random.randn(*args[0])

+
def randperm_validator(randperm_node: Node) -> bool:
    dtype = randperm_node.kwargs.get("dtype", None)
    layout = randperm_node.kwargs.get("layout", None)
    input = randperm_node.args[0]
    if not isinstance(input, int):
@@ -116,10 +117,11 @@
    args: Tuple[Argument, ...],
    kwargs: Dict[str, Argument],
    name: str,
) -> Union[TRTTensor, Sequence[TRTTensor]]:
    return np.random.permutation(args[0])
+

def empty_validator(empty_node: Node) -> bool:
    layout = empty_node.kwargs.get("layout", None)
    pin_memory = empty_node.kwargs.get("pin_memory", None)
    memory_format = empty_node.kwargs.get("memory_format", None)
@@ -162,8 +164,5 @@
    elif memory_format == torch.channels_last_3d:
        # shape of args[0] must be 5
        empty_tensor = empty_tensor.to(memory_format=torch.channels_last_3d)

    return empty_tensor
-
-
-

@apbose apbose force-pushed the empty_memory_format_evaluator branch from ad5b467 to fd330cf Compare May 24, 2024 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed component: api [Python] Issues re: Python API component: conversion Issues re: Conversion stage component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths component: tests Issues re: Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants