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
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]``.