from torch import nn
import torch
test = torch.tensor([1, 5., 4, 8, 9])
s = nn.Sigmoid()
print(s(test))
test = torch.tensor([[1, 5., 4, 8, 9],[1, 6., 4, 2, 7]])
s = nn.Sigmoid()
print(s(test))
結果:
tensor([0.7311, 0.9933, 0.9820, 0.9997, 0.9999])
tensor([[0.7311, 0.9933, 0.9820, 0.9997, 0.9999],
[0.7311, 0.9975, 0.9820, 0.8808, 0.9991]])
公式爲:
nn.Sigmoid torch
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
我在讀pyTorch文檔(一)
aiqiu_gogogo
2020-06-23 03:03:11
Pytorch學習踩坑筆記
定義一個類: class Processor(Base): def input_x(self, image_path): ''' 參數爲csv中作爲輸入x的一條數據,該方法會被Datase
PantaQl
2020-07-03 09:24:27
pytorch-分類模型模板
老三是只猫
2020-07-02 01:27:13
pytorch打卡學習(2)
好快的剑
2020-06-29 09:52:40
轉戰pytorch(2)——“簡單”訓練
刘炫320
2020-06-28 07:53:10
Pytorch學習---6深度學習數學基礎
GAIYA2050
2020-06-26 20:33:48
pytorch學習---5 在GPU上訓練 數據並行處理
GAIYA2050
2020-06-26 19:43:02
Pytorch學習---深度神經網絡
GAIYA2050
2020-06-26 19:43:02
pytorch張量基礎補充
tangzhaotz
2020-06-21 05:08:19
動手學習深度學習-梯度
tangzhaotz
2020-06-20 22:00:31
動手學習深度學習最新版(pytorch)-線性代數知識
tangzhaotz
2020-06-20 22:00:31
張量高階操作
tangzhaotz
2020-06-20 22:00:31
Pytorch學習:張量、自動微分和計算圖
CVAIDL
2020-06-16 14:48:01
pytorch 數據處理
后知还就那个后觉
2020-06-16 14:13:16