From: Xiang Gao Date: Tue, 26 Mar 2019 02:42:01 +0000 (-0700) Subject: Change deprecated IntList to IntArrayRef X-Git-Tag: accepted/tizen/6.5/unified/20211028.231830~637 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=674c274d92e5fde6218d39fa5d65658ad0efef05;p=platform%2Fupstream%2Fpytorch.git Change deprecated IntList to IntArrayRef Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/18262 Differential Revision: D14612244 Pulled By: ezyang fbshipit-source-id: 5d21c7b94d64104fececcb15c6d38d9bd2a1fc70 --- diff --git a/caffe2/contrib/aten/docs/pytorch_to_caffe2.md b/caffe2/contrib/aten/docs/pytorch_to_caffe2.md index 04ddaef..85c275b 100644 --- a/caffe2/contrib/aten/docs/pytorch_to_caffe2.md +++ b/caffe2/contrib/aten/docs/pytorch_to_caffe2.md @@ -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; ... }; ``` diff --git a/docs/cpp/source/notes/tensor_creation.rst b/docs/cpp/source/notes/tensor_creation.rst index df01acf..8d0fbcc 100644 --- a/docs/cpp/source/notes/tensor_creation.rst +++ b/docs/cpp/source/notes/tensor_creation.rst @@ -22,7 +22,7 @@ Let's bisect the various parts of this "schema": 1. ```` is the name of the function you would like to invoke, 2. ```` are any required or optional parameters a particular factory function accepts, -3. ```` is an object of type ``IntList`` and specifies the shape of the resulting tensor, +3. ```` is an object of type ``IntArrayRef`` and specifies the shape of the resulting tensor, 4. ```` 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`` and +constructing an ``IntArrayRef``. You can also pass an ``std::vector`` 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]``.