Change deprecated IntList to IntArrayRef
authorXiang Gao <qasdfgtyuiop@gmail.com>
Tue, 26 Mar 2019 02:42:01 +0000 (19:42 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 26 Mar 2019 02:47:21 +0000 (19:47 -0700)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/18262

Differential Revision: D14612244

Pulled By: ezyang

fbshipit-source-id: 5d21c7b94d64104fececcb15c6d38d9bd2a1fc70

caffe2/contrib/aten/docs/pytorch_to_caffe2.md
docs/cpp/source/notes/tensor_creation.rst

index 04ddaef..85c275b 100644 (file)
@@ -87,7 +87,7 @@ that determines the type. For instance, `ones` creates a new constant tensor of
 ```
 class Type {
        ...
-       virtual Tensor ones(IntList size) const;
+       virtual Tensor ones(IntArrayRef size) const;
        ...
 };
 ```
index df01acf..8d0fbcc 100644 (file)
@@ -22,7 +22,7 @@ Let's bisect the various parts of this "schema":
 
 1. ``<function-name>`` is the name of the function you would like to invoke,
 2. ``<functions-specific-options>`` are any required or optional parameters a particular factory function accepts,
-3. ``<sizes>`` is an object of type ``IntList`` and specifies the shape of the resulting tensor,
+3. ``<sizes>`` is an object of type ``IntArrayRef`` and specifies the shape of the resulting tensor,
 4. ``<tensor-options>`` is an instance of ``TensorOptions`` and configures the data type, device, layout and other properties of the resulting tensor.
 
 Picking a Factory Function
@@ -58,23 +58,23 @@ a vector with 5 components, initially all set to 1:
 
 
 What if we wanted to instead create a ``3 x 5`` matrix, or a ``2 x 3 x 4``
-tensor? In general, an ``IntList`` -- the type of the size parameter of factory
+tensor? In general, an ``IntArrayRef`` -- the type of the size parameter of factory
 functions -- is constructed by specifying the size along each dimension in
 curly braces. For example, ``{2, 3}`` for a tensor (in this case matrix) with
 two rows and three columns, ``{3, 4, 5}`` for a three-dimensional tensor, and
 ``{2}`` for a one-dimensional tensor with two components. In the one
 dimensional case, you can omit the curly braces and just pass the single
 integer like we did above. Note that the squiggly braces are just one way of
-constructing an ``IntList``. You can also pass an ``std::vector<int64_t>`` and
+constructing an ``IntArrayRef``. You can also pass an ``std::vector<int64_t>`` and
 a few other types. Either way, this means we can construct a three-dimensional
 tensor filled with values from a unit normal distribution by writing:
 
 .. code-block:: cpp
 
   torch::Tensor tensor = torch::randn({3, 4, 5});
-  assert(tensor.sizes() == torch::IntList{3, 4, 5});
+  assert(tensor.sizes() == torch::IntArrayRef{3, 4, 5});
 
-Notice how we use ``tensor.sizes()`` to get back an ``IntList`` containing the
+Notice how we use ``tensor.sizes()`` to get back an ``IntArrayRef`` containing the
 sizes we passed to the tensor. You can also write ``tensor.size(i)`` to access
 a single dimension, which is equivalent to but preferred over
 ``tensor.sizes()[i]``.