Skip to content

Commit

Permalink
add example in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ShigekiKarita committed May 9, 2020
1 parent b2d1bdd commit f0a723b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@
[![codecov](https://codecov.io/gh/ShigekiKarita/tfd/branch/master/graph/badge.svg)](https://codecov.io/gh/ShigekiKarita/tfd)
[![Dub version](https://img.shields.io/dub/v/tfd.svg)](https://code.dlang.org/packages/tfd)

## Example

```d
/// tensor add
import tfd;
import mir.ndslice : as, iota;
with (newGraph)
{
auto i = iota(2, 3, 4).as!float;
Operation x = placeholder!float("x", 2, 3, 4);
Operation two = constant(i);
Operation add = x + two;
Tensor addVal = session.run([add], [x: i.tensor])[0];
assert(addVal.sliced!(float, 3) == i * 2);
}
```

## Features

- [x] Setup CI
Expand Down

0 comments on commit f0a723b

Please sign in to comment.