Skip to content

Commit

Permalink
Various minor changes to public documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavm-nvidia committed Jan 15, 2025
1 parent cedb9d6 commit 66c4b0a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 57 deletions.
107 changes: 53 additions & 54 deletions tripy/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

# Tripy: A Python Programming Model For TensorRT

[**Installation**](#installation)
| [**Getting Started**](#getting-started)
[**Quick Start**](#quick-start)
| [**Installation**](#installation)
| [**Examples**](https://github.com/NVIDIA/TensorRT-Incubator/tree/main/tripy/examples)
| [**Notebooks**](https://github.com/NVIDIA/TensorRT-Incubator/tree/main/tripy/notebooks)
| [**Contributing**](https://github.com/NVIDIA/TensorRT-Incubator/blob/main/tripy/CONTRIBUTING.md)
Expand All @@ -17,53 +17,63 @@ a deep learning inference compiler.

What you can expect:

- **High Performance:** Leveraging [TensorRT](https://developer.nvidia.com/tensorrt)'s optimization capabilties.
- **High performance** by leveraging [TensorRT](https://developer.nvidia.com/tensorrt)'s optimization capabilties.
- An **intuitive API** that follows conventions of the ecosystem.
- **Debuggability** with features like **eager mode** to interactively debug mistakes.
- **Excellent error messages** that are informative and actionable.
- **Friendly documentation** that is comprehensive but concise, with code examples.

- **Intuitive API:** A familiar API that follows conventions of the ecosystem.

- **Debuggability:** **Eager mode** to interactively debug mistakes.
## Quick Start

- **Excellent Error Messages**: Informative and actionable.
See the
[Introduction To Tripy](https://nvidia.github.io/TensorRT-Incubator/pre0_user_guides/00-introduction-to-tripy.html)
guide for details:

- **Friendly Documentation**: Comprehensive but concise, with code examples.
<!-- Tripy: DOC: NO_PRINT_LOCALS Start -->
- **Defining** a model:

Code is worth 1,000 words:
```py
class Model(tp.Module):
def __init__(self):
self.conv = tp.Conv(in_channels=1, out_channels=1, kernel_dims=[3, 3])

<!-- Tripy: DOC: NO_PRINT_LOCALS Start -->
```py
# Define our model:
class Model(tp.Module):
def __init__(self):
self.conv = tp.Conv(in_channels=1, out_channels=1, kernel_dims=[3, 3])

def __call__(self, x):
x = self.conv(x)
x = tp.relu(x)
return x


# Initialize the model and load weights:
model = Model()
model.load_state_dict(
{
"conv.weight": tp.ones((1, 1, 3, 3)),
"conv.bias": tp.ones((1,)),
}
)

inp = tp.ones((1, 1, 4, 4))

# Eager mode:
eager_out = model(inp)

# Compiled mode:
compiled_model = tp.compile(
model,
args=[tp.InputInfo(shape=(1, 1, 4, 4), dtype=tp.float32)],
)

compiled_out = compiled_model(inp)
```
def __call__(self, x):
x = self.conv(x)
x = tp.relu(x)
return x
```

- **Initializing** it:

```py
model = Model()
model.load_state_dict(
{
"conv.weight": tp.ones((1, 1, 3, 3)),
"conv.bias": tp.ones((1,)),
}
)

dummy_input = tp.ones((1, 1, 4, 4))
```

- Executing in **eager mode**:

```py
eager_out = model(dummy_input)
```

- **Compiling** and executing:

```py
compiled_model = tp.compile(
model,
args=[tp.InputInfo(shape=(1, 1, 4, 4), dtype=tp.float32)],
)

compiled_out = compiled_model(dummy_input)
```
<!-- Tripy: DOC: NO_PRINT_LOCALS End -->


Expand Down Expand Up @@ -106,14 +116,3 @@ For the latest changes, build Tripy wheels from source:
python3 -c "import nvtripy as tp; x = tp.ones((5,), dtype=tp.int32); assert x.tolist() == [1] * 5"
```
<!-- Tripy: DOC: OMIT End -->


## Getting Started

- **Start with**:
[Introduction To Tripy](https://nvidia.github.io/TensorRT-Incubator/pre0_user_guides/00-introduction-to-tripy.html)

Other guides:

- [Compiling For Better Performance](https://nvidia.github.io/TensorRT-Incubator/pre0_user_guides/02-compiler.html)
- [Quantization](https://nvidia.github.io/TensorRT-Incubator/pre0_user_guides/01-quantization.html)
2 changes: 1 addition & 1 deletion tripy/docs/pre0_user_guides/00-introduction-to-tripy.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ a deep learning inference compiler.

## API Semantics

Unlike TensorRT's graph-based semantics, Tripy uses a functional style:
Unlike TensorRT's graph-based semantics, Tripy uses a **functional** style:

```py
# doc: no-print-locals
Expand Down
4 changes: 2 additions & 2 deletions tripy/nvtripy/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
module=sys.modules[__name__],
symbol="TensorLike",
doc="""
A Tripy :class:`Tensor` or a Python number that can be automatically converted into one.
A :class:`nvtripy.Tensor` or a Python number that can be automatically converted into one.
""",
)(Union["nvtripy.Tensor", numbers.Number])

Expand All @@ -53,6 +53,6 @@
module=sys.modules[__name__],
symbol="ShapeLike",
doc="""
A shape of a :class:`Tensor` .
A shape of a :class:`nvtripy.Tensor` .
""",
)(Sequence[IntLike])

0 comments on commit 66c4b0a

Please sign in to comment.