torch nn linear 28in features 2c out features 2c bias 3dtrue 29 discription

Solutions on MaxInterview for torch nn linear 28in features 2c out features 2c bias 3dtrue 29 discription by the best coders in the world

showing results for - "torch nn linear 28in features 2c out features 2c bias 3dtrue 29 discription"
Iris
10 Jan 2019
1import torch
2import torch.nn as nn
3
4x = torch.tensor([[1.0, -1.0],
5                  [0.0,  1.0],
6                  [0.0,  0.0]])
7
8in_features = x.shape[1]  # = 2
9out_features = 2
10
11m = nn.Linear(in_features, out_features)
12%%%%
13results would be 
14>>> m.weight
15tensor([[-0.4500,  0.5856],
16        [-0.1807, -0.4963]])
17
18>>> m.bias
19tensor([ 0.2223, -0.6114])
20%%%%