From 5581556ccca27b41850bdd483b59dd1082c4ae7f Mon Sep 17 00:00:00 2001 From: HansBug Date: Sun, 12 Sep 2021 23:06:44 +0800 Subject: [PATCH] refactor(hansbug): rename treetensor.tensor to treetensor.torch --- docs/source/api_doc/tensor/funcs.rstc | 1 - docs/source/api_doc/tensor/size.rstc | 1 - docs/source/api_doc/tensor/tensor.rstc | 1 - docs/source/api_doc/torch/funcs.rstc | 1 + docs/source/api_doc/{tensor => torch}/index.rst | 2 +- docs/source/api_doc/torch/size.rstc | 1 + docs/source/api_doc/torch/tensor.rstc | 1 + docs/source/index.rst | 2 +- test/__init__.py | 2 +- test/{tensor => torch}/__init__.py | 0 test/{tensor => torch}/test_funcs.py | 2 +- test/{tensor => torch}/test_treetensor.py | 2 +- treetensor/__init__.py | 2 +- treetensor/{tensor => torch}/__init__.py | 0 treetensor/{tensor => torch}/funcs.py | 0 treetensor/{tensor => torch}/size.py | 0 treetensor/{tensor => torch}/tensor.py | 0 17 files changed, 9 insertions(+), 9 deletions(-) delete mode 100644 docs/source/api_doc/tensor/funcs.rstc delete mode 100644 docs/source/api_doc/tensor/size.rstc delete mode 100644 docs/source/api_doc/tensor/tensor.rstc create mode 100644 docs/source/api_doc/torch/funcs.rstc rename docs/source/api_doc/{tensor => torch}/index.rst (84%) create mode 100644 docs/source/api_doc/torch/size.rstc create mode 100644 docs/source/api_doc/torch/tensor.rstc rename test/{tensor => torch}/__init__.py (100%) rename test/{tensor => torch}/test_funcs.py (99%) rename test/{tensor => torch}/test_treetensor.py (98%) rename treetensor/{tensor => torch}/__init__.py (100%) rename treetensor/{tensor => torch}/funcs.py (100%) rename treetensor/{tensor => torch}/size.py (100%) rename treetensor/{tensor => torch}/tensor.py (100%) diff --git a/docs/source/api_doc/tensor/funcs.rstc b/docs/source/api_doc/tensor/funcs.rstc deleted file mode 100644 index 8cf5eaefc..000000000 --- a/docs/source/api_doc/tensor/funcs.rstc +++ /dev/null @@ -1 +0,0 @@ -treetensor.tensor.funcs \ No newline at end of file diff --git a/docs/source/api_doc/tensor/size.rstc b/docs/source/api_doc/tensor/size.rstc deleted file mode 100644 index 7f2775e0f..000000000 --- a/docs/source/api_doc/tensor/size.rstc +++ /dev/null @@ -1 +0,0 @@ -treetensor.tensor.size \ No newline at end of file diff --git a/docs/source/api_doc/tensor/tensor.rstc b/docs/source/api_doc/tensor/tensor.rstc deleted file mode 100644 index 9c3b7eabc..000000000 --- a/docs/source/api_doc/tensor/tensor.rstc +++ /dev/null @@ -1 +0,0 @@ -treetensor.tensor.tensor \ No newline at end of file diff --git a/docs/source/api_doc/torch/funcs.rstc b/docs/source/api_doc/torch/funcs.rstc new file mode 100644 index 000000000..29fb2d7d7 --- /dev/null +++ b/docs/source/api_doc/torch/funcs.rstc @@ -0,0 +1 @@ +treetensor.torch.funcs \ No newline at end of file diff --git a/docs/source/api_doc/tensor/index.rst b/docs/source/api_doc/torch/index.rst similarity index 84% rename from docs/source/api_doc/tensor/index.rst rename to docs/source/api_doc/torch/index.rst index 2a63245be..bba292bb6 100644 --- a/docs/source/api_doc/tensor/index.rst +++ b/docs/source/api_doc/torch/index.rst @@ -1,4 +1,4 @@ -treetensor.tensor +treetensor.torch ===================== .. toctree:: diff --git a/docs/source/api_doc/torch/size.rstc b/docs/source/api_doc/torch/size.rstc new file mode 100644 index 000000000..b5514d0fb --- /dev/null +++ b/docs/source/api_doc/torch/size.rstc @@ -0,0 +1 @@ +treetensor.torch.size \ No newline at end of file diff --git a/docs/source/api_doc/torch/tensor.rstc b/docs/source/api_doc/torch/tensor.rstc new file mode 100644 index 000000000..542d41820 --- /dev/null +++ b/docs/source/api_doc/torch/tensor.rstc @@ -0,0 +1 @@ +treetensor.torch.tensor \ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst index 09ee1ad24..42b810aff 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -22,7 +22,7 @@ module. api_doc/common/index api_doc/config/index api_doc/numpy/index - api_doc/tensor/index + api_doc/torch/index api_doc/utils/index diff --git a/test/__init__.py b/test/__init__.py index 703505a6e..1105316c9 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -1,3 +1,3 @@ from .config import * from .numpy import * -from .tensor import * +from .torch import * diff --git a/test/tensor/__init__.py b/test/torch/__init__.py similarity index 100% rename from test/tensor/__init__.py rename to test/torch/__init__.py diff --git a/test/tensor/test_funcs.py b/test/torch/test_funcs.py similarity index 99% rename from test/tensor/test_funcs.py rename to test/torch/test_funcs.py index 6145b1cf0..23a2a4ec4 100644 --- a/test/tensor/test_funcs.py +++ b/test/torch/test_funcs.py @@ -2,7 +2,7 @@ import pytest import torch from treevalue import TreeValue -import treetensor.tensor as ttorch +import treetensor.torch as ttorch # noinspection DuplicatedCode diff --git a/test/tensor/test_treetensor.py b/test/torch/test_treetensor.py similarity index 98% rename from test/tensor/test_treetensor.py rename to test/torch/test_treetensor.py index 88ccede78..ed436370b 100644 --- a/test/tensor/test_treetensor.py +++ b/test/torch/test_treetensor.py @@ -4,7 +4,7 @@ import torch from treevalue import func_treelize import treetensor.numpy as tnp -import treetensor.tensor as ttorch +import treetensor.torch as ttorch _all_is = func_treelize(return_type=ttorch.TreeTensor)(lambda x, y: x is y) diff --git a/treetensor/__init__.py b/treetensor/__init__.py index 880905b5c..85e9a7cad 100644 --- a/treetensor/__init__.py +++ b/treetensor/__init__.py @@ -1,3 +1,3 @@ from .common import TreeObject from .numpy import TreeNumpy -from .tensor import TreeTensor +from .torch import TreeTensor diff --git a/treetensor/tensor/__init__.py b/treetensor/torch/__init__.py similarity index 100% rename from treetensor/tensor/__init__.py rename to treetensor/torch/__init__.py diff --git a/treetensor/tensor/funcs.py b/treetensor/torch/funcs.py similarity index 100% rename from treetensor/tensor/funcs.py rename to treetensor/torch/funcs.py diff --git a/treetensor/tensor/size.py b/treetensor/torch/size.py similarity index 100% rename from treetensor/tensor/size.py rename to treetensor/torch/size.py diff --git a/treetensor/tensor/tensor.py b/treetensor/torch/tensor.py similarity index 100% rename from treetensor/tensor/tensor.py rename to treetensor/torch/tensor.py -- GitLab