Horje
torch.nn.Linear(in_features, out_features, bias=True) discription Code Example
torch.nn.Linear(in_features, out_features, bias=True) discription
import torch
import torch.nn as nn

x = torch.tensor([[1.0, -1.0],
                  [0.0,  1.0],
                  [0.0,  0.0]])

in_features = x.shape[1]  # = 2
out_features = 2

m = nn.Linear(in_features, out_features)
%%%%
results would be 
>>> m.weight
tensor([[-0.4500,  0.5856],
        [-0.1807, -0.4963]])

>>> m.bias
tensor([ 0.2223, -0.6114])
%%%%




Python

Related
check command Code Example check command Code Example
markdown image embed url Code Example markdown image embed url Code Example
slug Code Example slug Code Example
install virtual environments_brew Code Example install virtual environments_brew Code Example
dataflair python Code Example dataflair python Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8