Skip to content

Commit a09ddc5

Browse files
author
Svetlana Karslioglu
authored
Merge pull request pytorch#1079 from raedle/site
Add PyTorch Live static docs
2 parents 93ab331 + 78bf8a1 commit a09ddc5

File tree

590 files changed

+16959
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

590 files changed

+16959
-0
lines changed

live/.nojekyll

Whitespace-only changes.

live/404.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!doctype html>
2+
<html lang="en" dir="ltr" class="plugin-native plugin-id-default">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width,initial-scale=1">
6+
<meta name="generator" content="Docusaurus v2.0.0-beta.21">
7+
<link rel="preconnect" href="https://www.google-analytics.com">
8+
<script>window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create","UA-117752657-2","auto"),ga("send","pageview")</script>
9+
<script async src="https://www.google-analytics.com/analytics.js"></script>
10+
11+
12+
<link rel="search" type="application/opensearchdescription+xml" title="Easy to use set of tools to create on-device ML demos on Android and iOS. Unlock the vast potential of AI innovations." href="/live/opensearch.xml">
13+
14+
15+
16+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/katex.min.css" integrity="sha384-Um5gpz1odJg5Z4HAmzPtgZKdTBHZdw8S29IecapCSB31ligYPhHQZMIlWLYQGVoc" crossorigin="anonymous">
17+
<script src="https://snack.expo.dev/embed.js" defer="defer"></script><title data-rh="true">Page Not Found | Easy to use set of tools to create on-device ML demos on Android and iOS. Unlock the vast potential of AI innovations.</title><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="https://pytorch.org/live/404.html"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docusaurus_tag" content="default"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docsearch:docusaurus_tag" content="default"><meta data-rh="true" property="og:title" content="Page Not Found | Easy to use set of tools to create on-device ML demos on Android and iOS. Unlock the vast potential of AI innovations."><link data-rh="true" rel="icon" href="/live/img/favicon.ico"><link data-rh="true" rel="canonical" href="https://pytorch.org/live/404.html"><link data-rh="true" rel="alternate" href="https://pytorch.org/live/404.html" hreflang="en"><link data-rh="true" rel="alternate" href="https://pytorch.org/live/404.html" hreflang="x-default"><link data-rh="true" rel="preconnect" href="https://A90B6S14WY-dsn.algolia.net" crossorigin="anonymous"><link rel="stylesheet" href="/live/assets/css/styles.d7a4bdf5.css">
18+
<link rel="preload" href="/live/assets/js/runtime~main.21ba93dd.js" as="script">
19+
<link rel="preload" href="/live/assets/js/main.ee757d47.js" as="script">
20+
</head>
21+
<body class="navigation-with-keyboard">
22+
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script>
23+
24+
<div style="display: none; text-align: center; background-color: white; color: black;" id="internaldocs-banner"></div><div id="__docusaurus">
25+
<div role="region"><a href="#" class="skipToContent_fXgn">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Navigation bar toggle" class="navbar__toggle clean-btn" type="button" tabindex="0"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://pytorch.org" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/live/img/pytorch_logo_black.png" alt="PyTorch Live Logo" class="themedImage_ToTc themedImage--light_HNdA"><img src="/live/img/pytorch_logo_black.png" alt="PyTorch Live Logo" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate"></b></a></div><div class="navbar__items navbar__items--right"><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a class="navbar__link" aria-haspopup="true" aria-expanded="false" role="button" href="/live/docs/tutorials/get-started/">0.2.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/live/docs/next/tutorials/get-started/">Next</a></li><li><a class="dropdown__link" href="/live/docs/tutorials/get-started/">0.2.0</a></li><li><a class="dropdown__link" href="/live/docs/0.1/tutorials/get-started/">0.1</a></li></ul></div><a class="navbar__item navbar__link" href="/live/">PyTorch Live</a><a class="navbar__item navbar__link" href="/live/docs/tutorials/get-started/">Tutorials</a><a class="navbar__item navbar__link" href="/live/docs/api/core/">API</a><a class="navbar__item navbar__link" href="/live/community/">Community</a><a href="https://github.com/pytorch/live" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link header-github-link" aria-label="GitHub repository"></a><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div class="main-wrapper"><main class="container margin-vert--xl"><div class="row"><div class="col col--6 col--offset-3"><h1 class="hero__title">Page Not Found</h1><p>We could not find what you were looking for.</p><p>Please contact the owner of the site that linked you to the original URL and let them know their link is broken.</p></div></div></main></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="row footer__links"><div class="col footer__col"><div class="footer__title">PyTorch Live</div><ul class="footer__items clean-list"><li class="footer__item"><a class="footer__link-item" href="/live/">Home</a></li><li class="footer__item"><a class="footer__link-item" href="/live/docs/tutorials/get-started/">Tutorials</a></li><li class="footer__item"><a class="footer__link-item" href="/live/docs/api/core/">API</a></li><li class="footer__item"><a class="footer__link-item" href="/live/community/">Community</a></li><li class="footer__item"><a href="https://pytorch.org" target="_blank" rel="noopener noreferrer" class="footer__link-item">PyTorch</a></li></ul></div><div class="col footer__col"><div class="footer__title">Community</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://github.com/pytorch/live/" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_lCJq"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://stackoverflow.com/questions/tagged/pytorch-live" target="_blank" rel="noopener noreferrer" class="footer__link-item">Stack Overflow<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_lCJq"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="col footer__col"><div class="footer__title">Legal</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://opensource.facebook.com/legal/privacy/" target="_blank" rel="noreferrer noopener" class="footer__link-item">Privacy<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_lCJq"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://opensource.facebook.com/legal/terms/" target="_blank" rel="noreferrer noopener" class="footer__link-item">Terms<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_lCJq"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="footer__bottom text--center"><div class="margin-bottom--sm"><a href="https://opensource.facebook.com" target="_blank" rel="noopener noreferrer" class="footerLogoLink_BH7S"><img src="/live/img/oss_logo.png" alt="Facebook Open Source Logo" class="themedImage_ToTc themedImage--light_HNdA footer__logo"><img src="/live/img/oss_logo.png" alt="Facebook Open Source Logo" class="themedImage_ToTc themedImage--dark_i4oU footer__logo"></a></div><div class="footer__copyright">Copyright © 2022 Facebook, Inc. Built with Docusaurus.</div></div></div></footer></div>
26+
<script src="/live/assets/js/runtime~main.21ba93dd.js"></script>
27+
<script src="/live/assets/js/main.ee757d47.js"></script>
28+
</body>
29+
</html>

live/_src/api/cli.md

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
---
2+
id: cli
3+
---
4+
5+
import TOCInline from '@theme/TOCInline';
6+
7+
# CLI
8+
9+
<div className="tutorial-page">
10+
11+
The PyTorch Live CLI (i.e., `torchlive-cli`) provides a set of commands to help you install build dependencies, initialize new PyTorch Live projects, build and deploy them to emulator or physical devices.
12+
13+
## Prerequisites
14+
15+
- **Node.js**: If you don't have it already, you can download Node.js LTS [from its website](https://nodejs.org/) or install via [Homebrew](https://formulae.brew.sh/formula/node) (ie, `brew install node`).
16+
17+
## Index {#index}
18+
19+
<TOCInline toc={toc} />
20+
21+
## PyTorch Live CLI commands {#torchlive-cli-commands}
22+
23+
Below is a list of PyTorch Live CLI commands and their usages:
24+
25+
#### Options {#options}
26+
27+
| Name | Description |
28+
| ------------- | ---------------------- |
29+
| `--version` | Prints the CLI version |
30+
| `--help` | Shows the CLI help |
31+
32+
### `npx torchlive-cli setup-dev` {#torchlive-cli-setup-dev}
33+
34+
The PyTorch Live CLI provides a setup routine to install all required build dependencies including tooling like Yarn, Watchman, and CocoaPods, SDKs like OpenJDK, Android SDK, Android SDK Manager, Android Virtual Device Manager, and an Android Emulator, and it installs a default emulator device ready to be used with PyTorch Live projects.
35+
36+
```shell
37+
npx torchlive-cli setup-dev
38+
```
39+
40+
:::note
41+
42+
The command may require `sudo` access for installing the different dependencies and can take approximately 20 minutes to complete. This depends on your laptop configuration, internet speed, and what dependencies have been installed previously.
43+
44+
:::
45+
46+
:::note
47+
48+
You only need to run the `npx torchlive-cli setup-dev` command once and it is not necessary to run the command every time before you start a new project. However, it is recommended to re-run this command once in a while to update development dependencies over time.
49+
50+
:::
51+
52+
If everything goes well, the terminal will looks similar to the following output.
53+
54+
```
55+
➜ npx torchlive-cli setup-dev
56+
_ _ _ _
57+
| |_ ___ _ __ ___| |__ | (_)_ _____
58+
| __/ _ \| '__/ __| '_ \| | \ \ / / _ \
59+
| || (_) | | | (__| | | | | |\ V / __/
60+
\__\___/|_| \___|_| |_|_|_| \_/ \___|
61+
62+
torchlive version 0.0.2-alpha.19
63+
✔ Homebrew (3.3.3)
64+
✔ OpenJDK (1.8.0)
65+
✔ Watchman (null)
66+
↓ Node (16.13.0) [SKIPPED]
67+
✔ Yarn (1.22.15)
68+
✔ Android SDK
69+
✔ Android SDK Manager
70+
✔ Android Emulator
71+
✔ CocoaPods (1.11.2)
72+
```
73+
74+
### `npx-torchlive-cli init [options] [name]` {#torchlive-cli-init}
75+
76+
Initialize a new PyTorch Live project.
77+
78+
```shell
79+
npx torchlive-cli init MyFirstProject
80+
```
81+
82+
#### Options {#torchlive-cli-init-options}
83+
84+
| Name | Default | Description |
85+
| ---------------- | ------------------------------------ | ----------------------------------------------------- |
86+
| `--template` | `react-native-template-pytorch-live` | Specifies the template used to generate a new project |
87+
| `--skip-install` | | Skips dependencies installation step |
88+
89+
### `npx torchlive-cli run-android [options]` {#torchlive-cli-run-android}
90+
91+
Runs the PyTorch Live project on an Android emulator. It will run the project on a physical device if it is connected.
92+
93+
```shell
94+
npx torchlive-cli run-android
95+
```
96+
97+
:::info
98+
99+
If you want to deploy the app on your own device, you have to put it into developer mode.
100+
101+
>On Android 4.1 and lower, the Developer options screen is available by default. On Android 4.2 and higher, you must enable this screen. To enable developer options follow the instructions from the Android Developers docs: [Enable developer options and USB debugging](https://developer.android.com/studio/debug/dev-options).
102+
103+
:::
104+
105+
#### Options {#torchlive-cli-run-android-options}
106+
107+
| Name | Default | Description |
108+
| ---------------- | ------------------------------------ | ------------------------------------------------------------------- |
109+
| `--name`, `-n` | `"pytorch_live"` | Run PyTorch Live project on a specific Android Virtual Device (AVD) |
110+
111+
### `npx torchlive-cli run-ios` {#torchlive-cli-run-ios}
112+
113+
Runs the PyTorch Live project on an iOS simulator.
114+
115+
:::info
116+
117+
In order to run a PyTorch Live project on an iOS simulator or a physical iOS device, you need to install Xcode from the Apple App Store on your macOS device. PyTorch Live currently supports Xcode version 12.5 or later.
118+
119+
:::
120+
121+
```shell
122+
npx torchlive-cli run-ios
123+
```
124+
125+
### `npx torchlive-cli emulator [options]` {#torchlive-cli-emulator}
126+
127+
Starts the "pytorch_live" Android Virtual Device emulator.
128+
129+
### `npx torchlive-cli clean` {#torchlive-cli-clean}
130+
131+
Cleans the build files and directories.
132+
133+
```shell
134+
npx torchlive-cli clean
135+
```
136+
137+
### `npx torchlive-cli emulator` {#torchlive-cli-emulator}
138+
139+
Starts the emulator without building, deploying, and running the PyTorch Live project.
140+
141+
```shell
142+
npx torchlive-cli emulator
143+
```
144+
145+
### `npx torchlive-cli doctor` {#torchlive-cli-doctor}
146+
147+
Runs health checks to verify if all necessary dependencies are installed.
148+
149+
```shell
150+
npx torchlive-cli doctor
151+
```
152+
153+
:::note
154+
155+
Run the `npx torchlive-cli setup-dev` command if any of the health checks fail.
156+
157+
:::
158+
159+
### `npx torchlive-cli log` {#torchlive-cli-log}
160+
161+
Prints the PyTorch Live CLI logs to the terminal.
162+
163+
```shell
164+
npx torchlive-cli log
165+
```
166+
167+
### `npx torchlive-cli help [command]` {#torchlive-cli-help}
168+
169+
Shows additional help for a command.
170+
171+
```shell
172+
npx torchlive-cli help init
173+
```
174+
175+
</div>

live/_src/api/core/_category_.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
label: "API"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
label: "Classes"
2+
position: 3
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
id: "cameraview.camera"
3+
title: "Class: Camera"
4+
sidebar_label: "Camera"
5+
custom_edit_url: null
6+
---
7+
8+
[CameraView](../modules/cameraview.md).Camera
9+
10+
A camera component with [CameraProps.onCapture](../interfaces/cameraview.cameraprops.md#oncapture) and [CameraProps.onFrame](../interfaces/cameraview.cameraprops.md#onframe) callbacks.
11+
To programmatically trigger a capture, call the [takePicture](cameraview.camera.md#takepicture) function.
12+
13+
```typescript
14+
export default function App() {
15+
const {imageClass, processImage} = useImageClassification(
16+
require('./resnet18.ptl'),
17+
);
18+
19+
const handleFrame = useCallback(
20+
async (image: Image) => {
21+
await processImage(image);
22+
image.release();
23+
},
24+
[processImage],
25+
);
26+
27+
return (
28+
<>
29+
<Camera
30+
style={styles.camera}
31+
onFrame={handleFrame}
32+
hideCaptureButton={true}
33+
/>
34+
<Text>{imageClass}</Text>
35+
</>
36+
);
37+
}
38+
```
39+
40+
**`component`**
41+
42+
## Hierarchy
43+
44+
- `PureComponent`<[CameraProps](../interfaces/cameraview.cameraprops.md)\>
45+
46+
**Camera**
47+
48+
## Methods
49+
50+
### flip
51+
52+
**flip**(): `void`
53+
54+
#### Returns
55+
56+
`void`
57+
58+
#### Defined in
59+
60+
[CameraView.tsx:212](https://github.com/pytorch/live/blob/966a71c9/react-native-pytorch-core/src/CameraView.tsx#L212)
61+
62+
___
63+
64+
### takePicture
65+
66+
**takePicture**(): `void`
67+
68+
The [takePicture](cameraview.camera.md#takepicture) function captures an image from the camera and then
69+
trigger the [onCapture](../interfaces/cameraview.cameraprops.md#oncapture) callback registered on the [Camera](cameraview.camera.md)
70+
component.
71+
72+
```typescript
73+
export default function CameraTakePicture() {
74+
const cameraRef = React.useRef<Camera>(null);
75+
76+
async function handleCapture(image: Image) {
77+
// Use captured image before releasing it.
78+
image.release();
79+
}
80+
81+
function handleTakePicture() {
82+
const camera = cameraRef.current;
83+
if (camera != null) {
84+
camera.takePicture();
85+
}
86+
}
87+
88+
return (
89+
<>
90+
<Camera
91+
ref={cameraRef}
92+
onCapture={handleCapture}
93+
hideCaptureButton={true}
94+
style={StyleSheet.absoluteFill}
95+
targetResolution={{width: 480, height: 640}}
96+
facing={CameraFacing.BACK}
97+
/>
98+
<Button title="Take Picture" onPress={handleTakePicture} />
99+
</>
100+
);
101+
}
102+
```
103+
104+
#### Returns
105+
106+
`void`
107+
108+
#### Defined in
109+
110+
[CameraView.tsx:198](https://github.com/pytorch/live/blob/966a71c9/react-native-pytorch-core/src/CameraView.tsx#L198)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
id: "text_basictokenizer.basictokenizer"
3+
title: "Class: BasicTokenizer"
4+
sidebar_label: "BasicTokenizer"
5+
custom_edit_url: null
6+
---
7+
8+
[text/BasicTokenizer](../modules/text_basictokenizer.md).BasicTokenizer
9+
10+
## Constructors
11+
12+
### constructor
13+
14+
**new BasicTokenizer**(`config`)
15+
16+
Construct a BasicTokenizer Object.
17+
18+
#### Parameters
19+
20+
| Name | Type | Description |
21+
| :------ | :------ | :------ |
22+
| `config` | [BasicTokenizerConfig](../modules/text_basictokenizer.md#basictokenizerconfig) | A basic tokenizer configuration object that specifies the non-splitable symbol, lowercase, customized punctuations, etc. |
23+
24+
#### Defined in
25+
26+
[text/BasicTokenizer.ts:18](https://github.com/pytorch/live/blob/966a71c9/react-native-pytorch-core/src/text/BasicTokenizer.ts#L18)
27+
28+
## Methods
29+
30+
### tokenize
31+
32+
**tokenize**(`text`): `string`[]
33+
34+
Tokenize any text with basic operations like lowercase transform, blackspace trimming and punctuation splitting.
35+
Normally used to clean text before passing to other tokenizers (e.g. wordpiece).
36+
37+
#### Parameters
38+
39+
| Name | Type | Description |
40+
| :------ | :------ | :------ |
41+
| `text` | `string` | The text to be processed |
42+
43+
#### Returns
44+
45+
`string`[]
46+
47+
#### Defined in
48+
49+
[text/BasicTokenizer.ts:70](https://github.com/pytorch/live/blob/966a71c9/react-native-pytorch-core/src/text/BasicTokenizer.ts#L70)

0 commit comments

Comments
 (0)