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

update v2.0-pre #953

Merged
merged 65 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
9ac1e78
Update doc URL. (#821)
csukuangfj Sep 8, 2021
bbe0ded
Support indexing 2-axes RaggedTensor, Support slicing for RaggedTenso…
pkufool Sep 14, 2021
2c28070
Prune with max_arcs in IntersectDense (#820)
pkufool Sep 14, 2021
210175c
Release v1.8
pkufool Sep 14, 2021
33a212c
Create a ragged tensor from a regular tensor. (#827)
csukuangfj Sep 15, 2021
971af7d
Trigger GitHub actions manually. (#829)
csukuangfj Sep 16, 2021
646704e
Run GitHub actions on merging. (#830)
csukuangfj Sep 16, 2021
8030001
Support printing ragged tensors in a more compact way. (#831)
csukuangfj Sep 17, 2021
d73a5b5
Add levenshtein alignment (#828)
pkufool Sep 19, 2021
f2fd997
Release v1.9
pkufool Sep 19, 2021
601d663
Support a[b[i]] where both a and b are ragged tensors. (#833)
csukuangfj Sep 25, 2021
8694fee
Display import error solution message on MacOS (#837)
pzelasko Sep 30, 2021
86e5479
Fix installation doc. (#841)
csukuangfj Oct 8, 2021
b72589c
fix typos in the install instructions (#844)
jtrmal Oct 13, 2021
6ac9795
make cmake adhere to the modernized way of finding packages outside d…
jtrmal Oct 13, 2021
2537a3f
import torch first in the smoke tests to preven SEGFAULT (#846)
jtrmal Oct 14, 2021
cae610a
Add doc about how to install a CPU version of k2. (#850)
csukuangfj Oct 23, 2021
d061bc6
Support PyTorch 1.10. (#851)
csukuangfj Oct 24, 2021
7178d67
Fix test cases for k2.union() (#853)
csukuangfj Oct 26, 2021
e6db5dc
Fix out-of-boundary access (read). (#859)
csukuangfj Nov 2, 2021
e8c589a
Update all the example codes in the docs (#861)
luomingshuang Nov 4, 2021
fd5565d
Fix compilation errors with CUB 1.15. (#865)
csukuangfj Nov 10, 2021
bdcaaf8
Update README. (#873)
csukuangfj Nov 12, 2021
31e1307
Fix ctc graph (make aux_labels of final arcs -1) (#877)
pkufool Nov 19, 2021
12f5915
Fix LICENSE location to k2 folder (#880)
lumaku Nov 24, 2021
a0d75c8
Release v1.11. (#881)
csukuangfj Nov 29, 2021
2cb3eea
Update documentation for hash.h (#887)
danpovey Dec 5, 2021
aab2dd7
Wrap MonotonicLowerBound (#883)
pkufool Dec 14, 2021
5517b3e
Remove extra commas after 'TOPSORTED' properity and fix RaggedTensor …
drawfish Dec 25, 2021
5f4cc79
Fix small typos (#896)
danpovey Jan 6, 2022
e799928
Fix k2.ragged.create_ragged_shape2 (#901)
csukuangfj Jan 13, 2022
d6323d5
Add rnnt loss (#891)
pkufool Jan 17, 2022
d3fbb1b
Use more efficient way to fix boundaries (#906)
pkufool Jan 25, 2022
9a91ec6
Release v1.12 (#907)
pkufool Jan 25, 2022
3367c7f
Change the sign of the rnnt_loss and add reduction argument (#911)
pkufool Jan 29, 2022
779a9bd
Fix building doc. (#908)
csukuangfj Jan 29, 2022
47c4b75
Fix building doc (#912)
pkufool Jan 29, 2022
cf32e2d
Support torch 1.10.x (#914)
csukuangfj Feb 8, 2022
9e7b2a9
Update INSTALL.rst (#915)
alexei-v-ivanov Feb 8, 2022
43ed450
Fix torch/cuda/python versions in the doc. (#918)
csukuangfj Feb 10, 2022
f4fefe4
Fix building for CUDA 11.6 (#917)
csukuangfj Feb 10, 2022
56edc82
Implement Unstack (#920)
pkufool Feb 20, 2022
854b792
SubsetRagged & PruneRagged (#919)
pkufool Feb 20, 2022
3cc74f1
Add Hash64 (#895)
pkufool Feb 22, 2022
0feefc7
Modified rnnt (#902)
pkufool Feb 25, 2022
2239c39
Fix Stack (#925)
wgb14 Feb 25, 2022
5ee082e
Fix 'TypeError' of rnnt_loss_pruned function. (#924)
drawfish Feb 27, 2022
36e2b8d
Support torch 1.11.0 and CUDA 11.5 (#931)
csukuangfj Mar 15, 2022
f4b4247
Implement Rnnt decoding (#926)
pkufool Mar 16, 2022
9a0d72c
fix building docs (#933)
pkufool Mar 16, 2022
6833270
Release v1.14
pkufool Mar 16, 2022
613e03d
Remove unused DiscountedCumSum. (#936)
csukuangfj Mar 17, 2022
281378f
Fix compiler warnings. (#937)
csukuangfj Mar 17, 2022
10b9423
Minor fixes for RNN-T decoding. (#938)
csukuangfj Mar 19, 2022
846c39c
Removes arcs with label 0 from the TrivialGraph. (#939)
csukuangfj Mar 29, 2022
0f65420
Implement linear_fsa_with_self_loops. (#940)
csukuangfj Mar 29, 2022
a830c60
Fix the pruning with max-states (#941)
pkufool Mar 30, 2022
8c28c86
Rnnt allow different encoder/decoder dims (#945)
danpovey Apr 3, 2022
d977865
Supporting building k2 on Windows (#946)
csukuangfj Apr 6, 2022
a4d76d2
Fix nightly windows CPU build (#948)
csukuangfj Apr 7, 2022
4fb6b88
Check the versions of PyTorch and CUDA at the import time. (#949)
csukuangfj Apr 8, 2022
9ebd757
More straightforward message when CUDA support is missing (#950)
nshmyrev Apr 11, 2022
3b83183
Implement ArrayOfRagged (#927)
LvHang Apr 12, 2022
1b29f0a
Fix precision (#951)
pkufool Apr 13, 2022
93d528a
Merge branch 'master' into v2.0
pkufool Apr 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Support printing ragged tensors in a more compact way. (#831)
* Support printing ragged tensors in a more compact way.

* Disable support for torch 1.3.1

* Fix test failures.
  • Loading branch information
csukuangfj authored Sep 17, 2021
commit 8030001c9a002aa17e090a41de3f1146bdfe1e78
1 change: 1 addition & 0 deletions .github/workflows/build-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ on:
branches:
- master
- doc
- doc-test

env:
# debug is faster in terms of compilation time
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/nightly-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,10 @@ jobs:
matrix:
os: [ubuntu-18.04, macos-10.15]
# Python 3.9 is for PyTorch 1.7.1, 1.8.x, 1.9.0
# torch 1.3.1 supports only Python 3.5/6/7
python-version: [3.6, 3.7, 3.8, 3.9]
torch: ["1.3.1", "1.4.0", "1.5.0", "1.5.1", "1.6.0", "1.7.0", "1.7.1", "1.8.0", "1.8.1", "1.9.0"]
torch: ["1.4.0", "1.5.0", "1.5.1", "1.6.0", "1.7.0", "1.7.1", "1.8.0", "1.8.1", "1.9.0"]
exclude:
- python-version: 3.9 # exclude Python 3.9 for [1.3.1, 1.4.0, 1.5.0, 1.5.1, 1.6.0, 1.7.0]
torch: "1.3.1"
- python-version: 3.9
- python-version: 3.9 # exclude Python 3.9 for [1.4.0, 1.5.0, 1.5.1, 1.6.0, 1.7.0]
torch: "1.4.0"
- python-version: 3.9
torch: "1.5.0"
Expand All @@ -56,8 +53,6 @@ jobs:
torch: "1.6.0"
- python-version: 3.9
torch: "1.7.0"
- python-version: 3.8 # exclude Python 3.8 for [1.3.1]
torch: "1.3.1"

steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 1 addition & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
import re
import sys
sys.path.insert(0, os.path.abspath('../../k2/python'))
sys.path.insert(0, os.path.abspath('../../build-ragged/lib'))
sys.path.insert(0, os.path.abspath('../../build/lib'))

import sphinx_rtd_theme

# -- Project information -----------------------------------------------------

project = 'k2'
copyright = '2020, k2 development team'
copyright = '2020-2021, k2 development team'
author = 'k2 development team'


Expand Down
47 changes: 41 additions & 6 deletions docs/source/installation/for_developers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ First, you have to install CMake, CUDA toolkit (with cuDNN), and PyTorch:
- CMake 3.11.0 and 3.18.0 are known to work. Other CMake versions may work
but they are not tested.

- Install PyTorch. PyTorch 1.5.x and above are known to work. Other PyTorch
- Install PyTorch. PyTorch 1.4.x and above are known to work. Other PyTorch
versions may work, but they are not tested.

- Install CUDA toolkit and cuDNN. CUDA 10.1 and above are known to work.
Expand Down Expand Up @@ -43,7 +43,7 @@ To build a release version, use:
python3 -c "import k2; print(k2.__file__)"
# It should print /some/path/k2/k2/python/k2/__init.py

python3 -c "import _k2; print(_k2.__file__)"
python3 -c "import torch; import _k2; print(_k2.__file__)"
# It should print /some/path/k2/build_release/lib/_k2.cpython-38-x86_64-linux-gnu.so
# (I assume that you're using Python 3.8, so there is a string 38 above)

Expand All @@ -63,10 +63,45 @@ To build a debug version, use:
python3 -c "import k2; print(k2.__file__)"
# It should print /some/path/k2/k2/python/k2/__init.py

python3 -c "import _k2; print(_k2.__file__)"
python3 -c "import torch; import _k2; print(_k2.__file__)"
# It should print /some/path/k2/build_debug/lib/_k2.cpython-38-x86_64-linux-gnu.so
# (I assume that you're using Python 3.8, so there is a string 38 above)

.. HINT::

You can pass the option ``-DK2_WITH_CUDA=OFF`` to ``cmake`` to build
a CPU only version of k2.

It is much faster to build a CPU version than that of building a CUDA
version. When you are adding new features to k2, we recommend you to
create a diretory to build a CPU version to test your code. Once it is
working on CPU, you can create a new directory to build a CUDA version
to test your code.

That is, while adding and testing new features, use:

.. code-block:: bash

cd k2
mkdir build-cpu
cd build-cpu
cmake -DK2_WITH_CUDA=OFF -DCMAKE_BUILD_TYPE=Debug ..
make -j5
export PYTHONPATH=$PWD/../k2/python:$PWD/lib:$PYTHONPATH
# make test # to test your code

After it is working for CPU, you can use:

.. code-block:: bash

cd k2
mkdir build-cuda
cd build-cuda
cmake -DCMAKE_BUILD_TYPE=Debug ..
make -j5
export PYTHONPATH=$PWD/../k2/python:$PWD/lib:$PYTHONPATH
# make test # to test your code

To run tests, use:

.. code-block:: bash
Expand Down Expand Up @@ -154,16 +189,16 @@ To run a specific Python test, use:

To check whether you are using a release version or a debug version, run:

.. code-block::
.. code-block:: bash

python3 -c "import _k2; print(_k2.__file__)"
python3 -c "import torch; import _k2; print(_k2.__file__)"

It should print the directory where k2 was built. That is,
the above output contains a string ``build_release`` or ``build_debug``.

Alternatively, you can run:

.. code-block::
.. code-block:: bash

python3 -m k2.version

Expand Down
77 changes: 40 additions & 37 deletions docs/source/installation/pip.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,77 +29,80 @@ versions of Python, CUDA, and PyTorch.
automagically. You don't need to pre-install PyTorch and cudatoolkit when using
``conda install``.

The following commands install k2 with different CUDA versions:
The following commands install k2 with different versions of CUDA and PyTorch:

.. code-block:: bash

# Install k2 0.3.3 with CUDA 10.2 built on 20210509
# Install k2 1.8 with CUDA 10.1 built on 20210916
#
# cu102 means CUDA 10.2
# You don't need to specifiy the Python version
#
pip install k2==0.3.3+cu102.dev20210509 -f https://k2-fsa.org/nightly/
pip install k2==1.8.dev20210916+cuda10.1.torch1.7.1 -f https://k2-fsa.org/nightly/

# Install k2 0.3.3 with CUDA 11.0 built on 20210509
# Install k2 1.8 with CUDA 10.2 built on 20210916
#
# cu110 means CUDA 11.0
#
pip install k2==0.3.3+cu110.dev20210509 -f https://k2-fsa.org/nightly/
pip install k2==1.8.dev20210916+cuda10.2.torch1.7.1 -f https://k2-fsa.org/nightly/

# Install k2 0.3.3 with CUDA 10.1 built on 20210509
# Install k2 1.8 with CUDA 11.0 built on 20210916
#
# CAUTION: you don't need to specify cu101 since CUDA 10.1 is the default
# CUDA version
#
pip install k2==0.3.3.dev20210509 -f https://k2-fsa.org/nightly/
pip install k2==1.8.dev20210916+cuda11.0.torch1.7.1 -f https://k2-fsa.org/nightly/

#
# dev20210509 means that version is built on 2021.05.09
#
# Please always select the latest version. That is, the version
# with the latest date.

.. Caution::

We only provide pre-compiled versions of k2 with torch 1.7.1. If you need
other versions of PyTorch, please consider one of the following alternatives
to install k2:

- :ref:`install using conda`
- :ref:`install k2 from source`

The following is the log for installing k2:

.. code-block::

$ pip install k2==0.3.3.dev20210509 -f https://k2-fsa.org/nightly/
Looking in links: https://k2-fsa.org/nightly/
Collecting k2==0.3.3.dev20210509
Downloading https://k2-fsa.org/nightly/whl/k2-0.3.3.dev20210509-cp38-cp38-linux_x86_64.whl (54.4 MB)
|________________________________| 54.4 MB 487 kB/s
Requirement already satisfied: torch in ./py38/lib/python3.8/site-packages (from k2==0.3.3.dev20210509) (1.7.1+cu101)
Requirement already satisfied: graphviz in ./py38/lib/python3.8/site-packages (from k2==0.3.3.dev20210509) (0.15)
Requirement already satisfied: numpy in ./py38/lib/python3.8/site-packages (from torch->k2==0.3.3.dev20210509) (1.19.5)
Requirement already satisfied: typing-extensions in ./py38/lib/python3.8/site-packages (from torch->k2==0.3.3.dev20210509) (3.7.4.3)
Installing collected packages: k2
Successfully installed k2-0.3.3.dev20210509
WARNING: You are using pip version 21.0.1; however, version 21.1.1 is available.
You should consider upgrading via the '/xxx/bin/python3.8 -m pip install --upgrade pip' command.
$ pip install k2==1.8.dev20210916+cuda10.1.torch1.7.1 -f https://k2-fsa.org/nightly

Looking in links: https://k2-fsa.org/nightly
Collecting k2==1.8.dev20210916+cuda10.1.torch1.7.1
Downloading https://k2-fsa.org/nightly/whl/k2-1.8.dev20210916%2Bcuda10.1.torch1.7.1-cp38-cp38-linux_x86_64.whl (77.7 MB)
|________________________________| 77.7 MB 1.6 MB/s
Collecting torch==1.7.1
Using cached torch-1.7.1-cp38-cp38-manylinux1_x86_64.whl (776.8 MB)
Collecting graphviz
Using cached graphviz-0.17-py3-none-any.whl (18 kB)
Collecting typing-extensions
Downloading typing_extensions-3.10.0.2-py3-none-any.whl (26 kB)
Collecting numpy
Using cached numpy-1.21.2-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (15.8 MB)
Installing collected packages: typing-extensions, numpy, torch, graphviz, k2
Successfully installed graphviz-0.17 k2-1.8.dev20210916+cuda10.1.torch1.7.1 numpy-1.21.2 torch-1.7.1 typing-extensions-3.10.0.2

To verify that k2 is installed successfully, run:

.. code-block::

$ python3 -m k2.version
/xxx/lib/python3.8/runpy.py:127: RuntimeWarning: 'k2.version' found in sys.modules after import of package 'k2', but prior to execution of 'k2.version'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
Collecting environment information...

k2 version: 0.3.3
k2 version: 1.8
Build type: Release
Git SHA1: 8e2fa82dca767782351fec57ec187aa04015dcf2
Git date: Thu May 6 18:55:15 2021
Git SHA1: 646704e142438bcd1aaf4a6e32d95e5ccd93a174
Git date: Thu Sep 16 13:05:12 2021
Cuda used to build k2: 10.1
cuDNN used to build k2: 8.0.2
Python version used to build k2: 3.8
OS used to build k2: Ubuntu 18.04.5 LTS
CMake version: 3.20.2
CMake version: 3.21.2
GCC version: 7.5.0
CMAKE_CUDA_FLAGS: -D_GLIBCXX_USE_CXX11_ABI=0 --expt-extended-lambda -gencode arch=compute_35,code=sm_35 --expt-extended-lambda -gencode arch=compute_50,code=sm_50 --expt-extended-lambda -gencode arch=compute_60,code=sm_60 --expt-extended-lambda -gencode arch=compute_61,code=sm_61 --expt-extended-lambda -gencode arch=compute_70,code=sm_70 --expt-extended-lambda -gencode arch=compute_75,code=sm_75 --compiler-options -Wall --compiler-options -Wno-unknown-pragmas
CMAKE_CXX_FLAGS: -D_GLIBCXX_USE_CXX11_ABI=0
CMAKE_CUDA_FLAGS: --expt-extended-lambda -gencode arch=compute_35,code=sm_35 --expt-extended-lambda -gencode arch=compute_50,code=sm_50 --expt-extended-lambda -gencode arch=compute_60,code=sm_60 --expt-extended-lambda -gencode arch=compute_61,code=sm_61 --expt-extended-lambda -gencode arch=compute_70,code=sm_70 --expt-extended-lambda -gencode arch=compute_75,code=sm_75 -D_GLIBCXX_USE_CXX11_ABI=0 --compiler-options -Wall --compiler-options -Wno-unknown-pragmas --compiler-options -Wno-strict-overflow
CMAKE_CXX_FLAGS: -D_GLIBCXX_USE_CXX11_ABI=0 -Wno-strict-overflow
PyTorch version used to build k2: 1.7.1+cu101
PyTorch is using Cuda: 10.1
NVTX enabled: True
With CUDA: True
Disable debug: True
Sync kernels : False
Disable checks: False
Expand Down
37 changes: 16 additions & 21 deletions docs/source/installation/pip_pypi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,45 +31,40 @@ The following command installs k2 from PyPI:

.. code-block:: bash

pip install --pre k2
pip install k2

The wheel packages on PyPI are built using `torch==1.7.1+cu101` on Ubuntu 18.04.
If you are using other Linux systems or a different PyTorch version,
the pre-built wheel packages may NOT work on your system, please install
k2 from source in this case.
.. Caution::

.. CAUTION::
The wheel packages on PyPI are built using `torch==1.7.1+cu101` on Ubuntu 18.04.
If you are using other Linux systems or a different PyTorch version, the
pre-built wheel packages may NOT work on your system, please consider one of
the following alternatives to install k2:

k2 is still under active development and we are trying to keep
the packages on PyPI up to date. Please use ``--pre`` in ``pip install``.

If you want to try the latest version, please refer to
:ref:`install k2 from source`.
- :ref:`install using conda`
- :ref:`install k2 from source`

To verify that k2 is installed successfully, run:

.. code-block::

$ python3 -m k2.version
/xxx/lib/python3.8/runpy.py:127: RuntimeWarning: 'k2.version' found in sys.modules after import of package 'k2', but prior to execution of 'k2.version'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
Collecting environment information...

k2 version: 0.3.3
k2 version: 1.8
Build type: Release
Git SHA1: d66cad5067563bb87710a40cf401af35cae816ff
Git date: Fri Apr 30 13:33:47 2021
Git SHA1: 646704e142438bcd1aaf4a6e32d95e5ccd93a174
Git date: Thu Sep 16 13:05:12 2021
Cuda used to build k2: 10.1
cuDNN used to build k2: 8.0.2
Python version used to build k2: 3.8
OS used to build k2: Ubuntu 18.04.5 LTS
CMake version: 3.20.1
GCC version: 5.5.0
CMAKE_CUDA_FLAGS: -D_GLIBCXX_USE_CXX11_ABI=0 --expt-extended-lambda -gencode arch=compute_35,code=sm_35 --expt-extended-lambda -gencode arch=compute_50,code=sm_50 --expt-extended-lambda -gencode arch=compute_60,code=sm_60 --expt-extended-lambda -gencode arch=compute_61,code=sm_61 --expt-extended-lambda -gencode arch=compute_70,code=sm_70 --expt-extended-lambda -gencode arch=compute_75,code=sm_75 --compiler-options -Wall --compiler-options -Wno-unknown-pragmas
CMAKE_CXX_FLAGS: -D_GLIBCXX_USE_CXX11_ABI=0
CMake version: 3.21.2
GCC version: 7.5.0
CMAKE_CUDA_FLAGS: --expt-extended-lambda -gencode arch=compute_35,code=sm_35 --expt-extended-lambda -gencode arch=compute_50,code=sm_50 --expt-extended-lambda -gencode arch=compute_60,code=sm_60 --expt-extended-lambda -gencode arch=compute_61,code=sm_61 --expt-extended-lambda -gencode arch=compute_70,code=sm_70 --expt-extended-lambda -gencode arch=compute_75,code=sm_75 -D_GLIBCXX_USE_CXX11_ABI=0 --compiler-options -Wall --compiler-options -Wno-unknown-pragmas --compiler-options -Wno-strict-overflow
CMAKE_CXX_FLAGS: -D_GLIBCXX_USE_CXX11_ABI=0 -Wno-strict-overflow
PyTorch version used to build k2: 1.7.1+cu101
PyTorch is using Cuda: 10.1
NVTX enabled: True
With CUDA: True
Disable debug: True
Sync kernels : False
Disable checks: False
Expand Down
7 changes: 7 additions & 0 deletions k2/python/csrc/torch/v2/any.cu
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ void PybindRaggedAny(py::module &m) {
[](const RaggedAny &self) -> std::string { return self.ToString(); },
kRaggedAnyStrDoc);

any.def(
"to_str_simple",
[](const RaggedAny &self) -> std::string {
return self.ToString(/*compact*/ true);
},
kRaggedAnyToStrSimpleDoc);

any.def(
"__repr__",
[](const RaggedAny &self) -> std::string { return self.ToString(); },
Expand Down
22 changes: 22 additions & 0 deletions k2/python/csrc/torch/v2/doc/any.h
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,28 @@ RaggedTensor([[1],
RaggedTensor([[1, 2]], device='cuda:0', dtype=torch.int32)
)doc";

static constexpr const char *kRaggedAnyToStrSimpleDoc = R"doc(
Convert a ragged tensor to a string representation, which
is more compact than ``self.__str__``.

An example output is given below::

RaggedTensor([[[1, 2, 3], [], [0]], [[2], [3, 10.5]]], dtype=torch.float32)

>>> import k2.ragged as k2r
>>> a = k2r.RaggedTensor([ [[1, 2, 3], [], [0]], [[2], [3, 10.5]] ])
>>> a
RaggedTensor([[[1, 2, 3],
[],
[0]],
[[2],
[3, 10.5]]], dtype=torch.float32)
>>> str(a)
'RaggedTensor([[[1, 2, 3],\n [],\n [0]],\n [[2],\n [3, 10.5]]], dtype=torch.float32)'
>>> a.to_str_simple()
'RaggedTensor([[[1, 2, 3], [], [0]], [[2], [3, 10.5]]], dtype=torch.float32)'
)doc";

static constexpr const char *kRaggedAnyGetItemDoc = R"doc(
Select the i-th sublist along axis 0.

Expand Down
Loading