| The ExpandDims op inserts single-dimensional
| entries into the shape of the input tensor
| data, and produces a single output
| tensor expanded.
|
| The op also takes an argument dims
| with a list of dimensions for where to
| add the single dimensional entries.
|
| If the same blob is provided as input
| and output, the operation is copy-free.
| This is the exact inverse operation
| of Squeeze.
|
| Github Links:
|
| - https://github.com/pytorch/pytorch/blob/master/caffe2/operators/expand_squeeze_dims_op.h
|
| - https://github.com/pytorch/pytorch/blob/master/caffe2/operators/expand_squeeze_dims_op.cc
|
| Broadcast the input tensor to a materialized
| new tensor using given shape.
|
| Broadcast rule is similar to “numpy.array(input)
| numpy.ones(shape)”:
|
| Dimensions are right alignment;
|
| Two corresponding dimensions must
| have the same value, or one of them equals
| to 1.
|
| In order to align with PyTorch’s expand
,
| shape
is allowed to have entries equal
| to -1, which means to preserve the size
| of the corresponding dimension in X
| (so it’s actually equivalent to equal
| to 1).
|
| The Squeeze op removes single-dimensional
| entries from the shape of the input tensor
| data, and produces a single output
| tensor squeezed.
|
| The op also takes an argument dims
| with a list of dimensions to squeeze.
|
| If the same blob is provided as input
| and output, the operation is copy-free.
|
| This is the exact inverse operation
| of
|
| ExpandDims* given the same dims argument.
|
| Github Links:
|
| - https://github.com/pytorch/pytorch/blob/master/caffe2/operators/expand_squeeze_dims_op.h
|
| - https://github.com/pytorch/pytorch/blob/master/caffe2/operators/expand_squeeze_dims_op.cc
|