pytorch知識點總結

2021-09-01 19:35:42 字數 692 閱讀 2562

它是linear space的縮寫,中文含義為線性等分向量,線性平分向量,線性平分向量。 然後從pytorch的官方**上找到了這個函式的詳細說明。

torch.linspace(start, end, steps=100, out=none, dtype=none, layout=torch.strided, device=none, requires_grad=false) → tensor
函式的作用是,返回乙個一維的tensor(張量),這個張量包含了從start到end,分成steps個線段得到的向量。常用的幾個變數

start:開始值

end:結束值

steps:分割的點數,預設是100

dtype:返回值(張量)的資料型別

舉例:

import torch

print(torch.linspace(3,10,5))

#tensor([ 3.0000, 4.7500, 6.5000, 8.2500, 10.0000])

type=torch.float

print(torch.linspace(-10,10,steps=6,dtype=type))

#tensor([-10., -6., -2., 2., 6., 10.])

知識點總結

1,迴圈中的中斷 continue 跳出此次迴圈,繼續for迴圈 break 跳出當前for迴圈 return 跳出當前方法 2,字串的操作 componentseparatedbystring stringbyreplacingoccurencesofstring withstring iskin...

知識點總結

oncreate onstrat onresume onpause onstop onrestart ondestroy standard 啟動activity都會產生乙個新的activity 預設模式 singletop 啟動activity允許多個,但不允許重疊 singletask 只允許有乙...

知識點總結

function go go 呼叫 go為變數名 setinterval go,1000 1000ms clearinterval 關閉定時器 function abc a,b 2,3 5undefined 未定義 null 空 nan 非數值 string 字串 var a 123 數字型別 va...