Pytorch学习笔记——reshape和view的区别
来源:http://www.tudoupe.com时间:2022-03-18
前言
如果你使用Pytorch或阅读别人的代码,有什么区别? 两种矩阵变形的重塑和视图都是最常用的代码。
我不确定,pytoch.http://ww.un.org/t/difference-weather-view-reshape-and-permute/54157。
ptrblock是原作者。
Reshape
在可行的情况下,重塑试图恢复观点的尝试;否则,它将数据复制为连续(连续)量,并返回关于该数量的观点。
它是官方文件的摘要;然后,通过重塑的正式文件阅读并确认这些文件。
Returns a tensor with the same data and number of elements as input, but with the specified shape. When possible, the returned tensor will be a view of input. Otherwise, it will be a copy. Contiguous inputs and inputs with compatible strides can be reshaped without copying, but you should not depend on the copying vs. viewing behavior.
返回一个音量,其数据和元素与输入量相同,但与提供的形状相同。
如果可行,返回的负载将是输入的视图;否则,将退回一份副本。
可以创建不复制、连续和兼容的频带输入。reshape,但不应依赖于copying vs. viewing行为。
您可以看到, Tensor. View () 定义它何时返回 。
代码示例
相关新闻
- 2023-05-06 微pe怎么初始化U盘(微pe怎么恢复初
- 2023-05-06 Xp系统boot 进入pe(boot manager 怎么进入
- 2023-05-06 win pe修复bcdboot(pe修复系统)
- 2023-05-06 win7更新失败 pe(win7更新失败还原更
- 2023-05-06 u盘装了pe读取不了(u盘能进pe读取不
- 2023-05-06 u盘pe 发热(u盘发热烫手)
- 2023-05-06 u盘pe下看不到硬盘(u盘启动pe看不到
- 2023-05-06 pe盘 ntfs(u盘ntfs格式)
- 2023-05-06 sony笔记本进入pe模式(联想笔记本怎
- 2023-05-06 pe启动盘进不去(pe启动盘进不去系统
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
