Tensor 操作#
基本操作#
Copies values from one array to another, broadcasting as necessary. |
形状操作#
Gives a new shape to a tensor without changing its data. |
|
Return a contiguous flattened tensor. |
变换#
Move axes of a tensor to new positions. |
|
Roll the specified axis backwards, until it lies in a given position. |
|
Interchange two axes of a tensor. |
|
Same as self.transpose(), except that self is returned if self.ndim < 2. |
|
Permute the dimensions of a tensor. |
修改维度#
Convert inputs to tensors with at least one dimension. |
|
View inputs as tensors with at least two dimensions. |
|
View inputs as tensors with at least three dimensions. |
|
Broadcast an tensor to a new shape. |
|
Broadcast any number of arrays against each other. |
|
Expand the shape of a tensor. |
|
Remove single-dimensional entries from the shape of a tensor. |
修改 Tensor 类型#
Convert the input to an array. |
合并 Tensor#
Join a sequence of arrays along an existing axis. |
|
Join a sequence of tensors along a new axis. |
|
Stack 1-D tensors as columns into a 2-D tensor. |
|
Stack tensors in sequence depth wise (along third axis). |
|
Stack tensors in sequence horizontally (column wise). |
|
Stack tensors in sequence vertically (row wise). |
拆分 Tensor#
Split a tensor into multiple sub-tensors. |
|
Split a tensor into multiple sub-tensors. |
|
Split tensor into multiple sub-tensors along the 3rd axis (depth). |
|
Split a tensor into multiple sub-tensors horizontally (column-wise). |
|
Split a tensor into multiple sub-tensors vertically (row-wise). |
对 Tensor 分块#
Construct a tensor by repeating A the number of times given by reps. |
|
Repeat elements of a tensor. |
添加和删除元素#
Return a new array with sub-arrays along an axis deleted. |
|
Insert values along the given axis before the given indices. |
|
Append values to the end of an array. |
|
Find the unique elements of a tensor. |
元素重排#
Reverse the order of elements in a tensor along the given axis. |
|
Flip tensor in the left/right direction. |
|
Flip tensor in the up/down direction. |
|
Gives a new shape to a tensor without changing its data. |
|
Roll tensor elements along a given axis. |