Skip to content

Commit

Permalink
Merge pull request torch#557 from Moodstocks/storage-ptr-siz
Browse files Browse the repository at this point in the history
doc/storage: add precisions for ptr, size mode
  • Loading branch information
soumith committed Feb 23, 2016
2 parents a868428 + d37d4ba commit 3bbb49f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions doc/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ function. By default, this "points" on `torch.DoubleStorage`.
Returns a new `Storage` of type `TYPE`. Valid `TYPE` are `Byte`, `Char`, `Short`,
`Int`, `Long`, `Float`, and `Double`. If `size` is given, resize the
`Storage` accordingly, else create an empty `Storage`.
The optional second argument `ptr` is a number whose value is a
pointer to a memory chunk of size `size*sizeof(TYPE)` (for example coming from the
[`torch.data()`](https://github.com/torch/torch7/blob/master/doc/tensor.md#result-datatensor-asnumber)
method). The Storage will take care of freeing the memory
chunk: it _must not be freed by the caller_!

Example:
```lua
Expand All @@ -58,6 +53,11 @@ x = torch.DoubleStorage(10)

The data in the `Storage` is _uninitialized_.

The optional second argument `ptr` is a number whose value is a
pointer to a memory chunk of size `size*sizeof(TYPE)` (for example coming from the
[`torch.data()`](tensor.md#result-datatensor-asnumber)
method). The caller remains responsible of the memory chunk and must ensure it remains stable as the storage only keeps a pointer to it (the memory is _not_ copied and will _not_ be freed at storage deletion).

<a name="torch.Storage"></a>
### torch.TYPEStorage(table) ###

Expand Down

0 comments on commit 3bbb49f

Please sign in to comment.