Skip to content

Commit

Permalink
fixed generic-functions guide
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Rauber committed Aug 14, 2020
1 parent 6f56ffc commit 3fe271a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/guide/generic-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Generic Functions

# Implementing Generic Framework-Agnostic Functions

Using the conversion functions shown in \appendixref{sec:converting}, we can already define a simple framework-agnostic function. This function can be called with a native tensor from any framework and it will return the norm of that tensor, again as a native tensor from that framework (\autoref{alg:calling_norm_pytorch}, \autoref{alg:calling_norm_tensorflow}).
Using the conversion functions shown in [Converting](./converting.md), we can already define a simple framework-agnostic function.

```pyhon
import eagerpy as ep
Expand All @@ -16,6 +16,8 @@ def norm(x):
return result.raw
```

This function can be called with a native tensor from any framework and it will return the norm of that tensor, again as a native tensor from that framework.

Calling the `norm` function using a PyTorch tensor:
```pyhon
import torch
Expand Down

0 comments on commit 3fe271a

Please sign in to comment.