From 73d2f3cc51fad2a365c707fba4cf8f7e04dd7dfd Mon Sep 17 00:00:00 2001 From: vmoens Date: Fri, 26 Jan 2024 10:56:14 +0000 Subject: [PATCH 1/3] init --- tensordict/_torch_func.py | 6 +++--- tensordict/base.py | 30 +++++++++++++++--------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tensordict/_torch_func.py b/tensordict/_torch_func.py index 6b5dcadc9..1a64db1a1 100644 --- a/tensordict/_torch_func.py +++ b/tensordict/_torch_func.py @@ -376,10 +376,10 @@ def _stack( From v0.4 onward, a dense stack will be returned and to build a lazy stack, an explicit call to LazyStackedTensorDict.lazy_stack will be required. To silence this warning, choose one of the following options: -- set the LAZY_LEGACY_OP to 'True' (recommended) or 'False' depending on +- set the LAZY_LEGACY_OP to 'False' (recommended) or 'True' depending on the behaviour you want to use. Another way to achieve this is to call - `tensordict.set_lazy_legacy(True).set()` at the beginning of your script. -- set the decorator/context manager `tensordict.set_lazy_legacy(True)` (recommended) around + `tensordict.set_lazy_legacy(False).set()` at the beginning of your script. +- set the decorator/context manager `tensordict.set_lazy_legacy(False)` (recommended) around the function or code block where stack is used. - Use `LazyStackedTensorDict.lazy_stack()` if it is a lazy stack that you wish to use.""", category=DeprecationWarning, diff --git a/tensordict/base.py b/tensordict/base.py index 3d52b3acb..6c2745b8c 100644 --- a/tensordict/base.py +++ b/tensordict/base.py @@ -682,10 +682,10 @@ def unsqueeze(self, *args, **kwargs): version of the unsqueezed tensordict. Up until v0.3 included, a lazy unsqueezed tensordict was returned. From v0.4 onward, a dense unsqueeze will be returned. To silence this warning, choose one of the following options: -- set the LAZY_LEGACY_OP to 'True' (recommended) or 'False' depending on +- set the LAZY_LEGACY_OP to 'False' (recommended) or 'True' depending on the behaviour you want to use. Another way to achieve this is to call - `tensordict.set_lazy_legacy(True).set()` at the beginning of your script. -- set the decorator/context manager `tensordict.set_lazy_legacy(True)` (recommended) around + `tensordict.set_lazy_legacy(False).set()` at the beginning of your script. +- set the decorator/context manager `tensordict.set_lazy_legacy(False)` (recommended) around the function or code block where stack is used. To temporarily unsqueeze a tensordict you can still user unsqueeze() as a context manager (see docstrings). @@ -771,10 +771,10 @@ def squeeze(self, *args, **kwargs): version of the squeezed tensordict. Up until v0.3 included, a lazy squeezed tensordict was returned. From v0.4 onward, a dense squeeze will be returned. To silence this warning, choose one of the following options: -- set the LAZY_LEGACY_OP to 'True' (recommended) or 'False' depending on +- set the LAZY_LEGACY_OP to 'False' (recommended) or 'True' depending on the behaviour you want to use. Another way to achieve this is to call - `tensordict.set_lazy_legacy(True).set()` at the beginning of your script. -- set the decorator/context manager `tensordict.set_lazy_legacy(True)` (recommended) around + `tensordict.set_lazy_legacy(False).set()` at the beginning of your script. +- set the decorator/context manager `tensordict.set_lazy_legacy(False)` (recommended) around the function or code block where stack is used. To temporarily squeeze a tensordict you can still user squeeze() as a context manager (see docstrings). @@ -983,10 +983,10 @@ def view( version of the viewed tensordict. Up until v0.3 included, a lazy view of the tensordict was returned. From v0.4 onward, a proper view will be returned. To silence this warning, choose one of the following options: -- set the LAZY_LEGACY_OP to 'True' (recommended) or 'False' depending on +- set the LAZY_LEGACY_OP to 'False' (recommended) or 'True' depending on the behaviour you want to use. Another way to achieve this is to call - `tensordict.set_lazy_legacy(True).set()` at the beginning of your script. -- set the decorator/context manager `tensordict.set_lazy_legacy(True)` (recommended) around + `tensordict.set_lazy_legacy(False).set()` at the beginning of your script. +- set the decorator/context manager `tensordict.set_lazy_legacy(False)` (recommended) around the function or code block where stack is used. To temporarily view a tensordict you can still user view() as a context manager (see docstrings). @@ -1052,10 +1052,10 @@ def transpose(self, dim0, dim1): version of the transposed tensordict. Up until v0.3 included, a lazy transpose of the tensordict was returned. From v0.4 onward, a proper transpose will be returned. To silence this warning, choose one of the following options: -- set the LAZY_LEGACY_OP to 'True' (recommended) or 'False' depending on +- set the LAZY_LEGACY_OP to 'False' (recommended) or 'True' depending on the behaviour you want to use. Another way to achieve this is to call - `tensordict.set_lazy_legacy(True).set()` at the beginning of your script. -- set the decorator/context manager `tensordict.set_lazy_legacy(True)` (recommended) around + `tensordict.set_lazy_legacy(False).set()` at the beginning of your script. +- set the decorator/context manager `tensordict.set_lazy_legacy(False)` (recommended) around the function or code block where stack is used. To temporarily transpose a tensordict you can still user transpose() as a context manager (see docstrings). @@ -1167,10 +1167,10 @@ def permute(self, *args, **kwargs): version of the permuted tensordict. Up until v0.3 included, a lazy permute of the tensordict was returned. From v0.4 onward, a proper permute will be returned. To silence this warning, choose one of the following options: -- set the LAZY_LEGACY_OP to 'True' (recommended) or 'False' depending on +- set the LAZY_LEGACY_OP to 'False' (recommended) or 'True' depending on the behaviour you want to use. Another way to achieve this is to call - `tensordict.set_lazy_legacy(True).set()` at the beginning of your script. -- set the decorator/context manager `tensordict.set_lazy_legacy(True)` (recommended) around + `tensordict.set_lazy_legacy(False).set()` at the beginning of your script. +- set the decorator/context manager `tensordict.set_lazy_legacy(False)` (recommended) around the function or code block where stack is used. To temporarily permute a tensordict you can still user permute() as a context manager (see docstrings). From cdc79cb8144ad6276f36628ab9dc1631d06e2866 Mon Sep 17 00:00:00 2001 From: vmoens Date: Fri, 26 Jan 2024 10:59:34 +0000 Subject: [PATCH 2/3] amend --- tensordict/_torch_func.py | 2 +- tensordict/base.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tensordict/_torch_func.py b/tensordict/_torch_func.py index 1a64db1a1..087b49534 100644 --- a/tensordict/_torch_func.py +++ b/tensordict/_torch_func.py @@ -376,7 +376,7 @@ def _stack( From v0.4 onward, a dense stack will be returned and to build a lazy stack, an explicit call to LazyStackedTensorDict.lazy_stack will be required. To silence this warning, choose one of the following options: -- set the LAZY_LEGACY_OP to 'False' (recommended) or 'True' depending on +- set the LAZY_LEGACY_OP environment variable to 'False' (recommended) or 'True' depending on the behaviour you want to use. Another way to achieve this is to call `tensordict.set_lazy_legacy(False).set()` at the beginning of your script. - set the decorator/context manager `tensordict.set_lazy_legacy(False)` (recommended) around diff --git a/tensordict/base.py b/tensordict/base.py index 6c2745b8c..848aab771 100644 --- a/tensordict/base.py +++ b/tensordict/base.py @@ -682,7 +682,7 @@ def unsqueeze(self, *args, **kwargs): version of the unsqueezed tensordict. Up until v0.3 included, a lazy unsqueezed tensordict was returned. From v0.4 onward, a dense unsqueeze will be returned. To silence this warning, choose one of the following options: -- set the LAZY_LEGACY_OP to 'False' (recommended) or 'True' depending on +- set the LAZY_LEGACY_OP environment variable to 'False' (recommended) or 'True' depending on the behaviour you want to use. Another way to achieve this is to call `tensordict.set_lazy_legacy(False).set()` at the beginning of your script. - set the decorator/context manager `tensordict.set_lazy_legacy(False)` (recommended) around @@ -771,7 +771,7 @@ def squeeze(self, *args, **kwargs): version of the squeezed tensordict. Up until v0.3 included, a lazy squeezed tensordict was returned. From v0.4 onward, a dense squeeze will be returned. To silence this warning, choose one of the following options: -- set the LAZY_LEGACY_OP to 'False' (recommended) or 'True' depending on +- set the LAZY_LEGACY_OP environment variable to 'False' (recommended) or 'True' depending on the behaviour you want to use. Another way to achieve this is to call `tensordict.set_lazy_legacy(False).set()` at the beginning of your script. - set the decorator/context manager `tensordict.set_lazy_legacy(False)` (recommended) around @@ -983,7 +983,7 @@ def view( version of the viewed tensordict. Up until v0.3 included, a lazy view of the tensordict was returned. From v0.4 onward, a proper view will be returned. To silence this warning, choose one of the following options: -- set the LAZY_LEGACY_OP to 'False' (recommended) or 'True' depending on +- set the LAZY_LEGACY_OP environment variable to 'False' (recommended) or 'True' depending on the behaviour you want to use. Another way to achieve this is to call `tensordict.set_lazy_legacy(False).set()` at the beginning of your script. - set the decorator/context manager `tensordict.set_lazy_legacy(False)` (recommended) around @@ -1052,7 +1052,7 @@ def transpose(self, dim0, dim1): version of the transposed tensordict. Up until v0.3 included, a lazy transpose of the tensordict was returned. From v0.4 onward, a proper transpose will be returned. To silence this warning, choose one of the following options: -- set the LAZY_LEGACY_OP to 'False' (recommended) or 'True' depending on +- set the LAZY_LEGACY_OP environment variable to 'False' (recommended) or 'True' depending on the behaviour you want to use. Another way to achieve this is to call `tensordict.set_lazy_legacy(False).set()` at the beginning of your script. - set the decorator/context manager `tensordict.set_lazy_legacy(False)` (recommended) around @@ -1167,7 +1167,7 @@ def permute(self, *args, **kwargs): version of the permuted tensordict. Up until v0.3 included, a lazy permute of the tensordict was returned. From v0.4 onward, a proper permute will be returned. To silence this warning, choose one of the following options: -- set the LAZY_LEGACY_OP to 'False' (recommended) or 'True' depending on +- set the LAZY_LEGACY_OP environment variable to 'False' (recommended) or 'True' depending on the behaviour you want to use. Another way to achieve this is to call `tensordict.set_lazy_legacy(False).set()` at the beginning of your script. - set the decorator/context manager `tensordict.set_lazy_legacy(False)` (recommended) around From 44170faed201dbdb08402eef90b4fc6e59d806c7 Mon Sep 17 00:00:00 2001 From: vmoens Date: Fri, 26 Jan 2024 11:02:30 +0000 Subject: [PATCH 3/3] amend --- tensordict/base.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tensordict/base.py b/tensordict/base.py index 848aab771..3bbde8efe 100644 --- a/tensordict/base.py +++ b/tensordict/base.py @@ -686,7 +686,7 @@ def unsqueeze(self, *args, **kwargs): the behaviour you want to use. Another way to achieve this is to call `tensordict.set_lazy_legacy(False).set()` at the beginning of your script. - set the decorator/context manager `tensordict.set_lazy_legacy(False)` (recommended) around - the function or code block where stack is used. + the function or code block where unsqueeze is used. To temporarily unsqueeze a tensordict you can still user unsqueeze() as a context manager (see docstrings). """, @@ -775,7 +775,7 @@ def squeeze(self, *args, **kwargs): the behaviour you want to use. Another way to achieve this is to call `tensordict.set_lazy_legacy(False).set()` at the beginning of your script. - set the decorator/context manager `tensordict.set_lazy_legacy(False)` (recommended) around - the function or code block where stack is used. + the function or code block where squeeze is used. To temporarily squeeze a tensordict you can still user squeeze() as a context manager (see docstrings). """, @@ -987,7 +987,7 @@ def view( the behaviour you want to use. Another way to achieve this is to call `tensordict.set_lazy_legacy(False).set()` at the beginning of your script. - set the decorator/context manager `tensordict.set_lazy_legacy(False)` (recommended) around - the function or code block where stack is used. + the function or code block where view is used. To temporarily view a tensordict you can still user view() as a context manager (see docstrings). """, @@ -1056,7 +1056,7 @@ def transpose(self, dim0, dim1): the behaviour you want to use. Another way to achieve this is to call `tensordict.set_lazy_legacy(False).set()` at the beginning of your script. - set the decorator/context manager `tensordict.set_lazy_legacy(False)` (recommended) around - the function or code block where stack is used. + the function or code block where transpose is used. To temporarily transpose a tensordict you can still user transpose() as a context manager (see docstrings). """, @@ -1171,7 +1171,7 @@ def permute(self, *args, **kwargs): the behaviour you want to use. Another way to achieve this is to call `tensordict.set_lazy_legacy(False).set()` at the beginning of your script. - set the decorator/context manager `tensordict.set_lazy_legacy(False)` (recommended) around - the function or code block where stack is used. + the function or code block where permute is used. To temporarily permute a tensordict you can still user permute() as a context manager (see docstrings). """,