Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Renamed task1 and submitted task2
  • Loading branch information
Ashwin-Rajesh committed Jun 22, 2020
commit 14f92e7b73451f9fd3e5444bfc3c2525fe67502c
14 changes: 14 additions & 0 deletions Tasks/daily tasks/Ashwin-Rajesh/Task2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/python3.7

import numpy as np
import torch

np.random.seed(0)

array_a = np.random.randn(5,3)
array_b = np.random.randn(3,4)

tensor_a = torch.tensor(array_a)
tensor_b = torch.tensor(array_b)

print(tensor_a.matmul(tensor_b))
24 changes: 24 additions & 0 deletions Tasks/daily tasks/Ashwin-Rajesh/Task3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import numpy

import torch
import torch.nn.functional as F
import torch.nn as nn

class neural_net(nn.Module):
# Arguments : input size, output size, hidden layer sizes
def __init__(self, s_in, s_out, h_1, h_2, h_3):
super().__init__()
self.in_layer = nn.Linear(s_in, h_1)
self.h1_layer = nn.Linear(h_1, h_2)
self.h2_layer = nn.Linear(h_2, h_3)
self.out_layer = nn.Linear(h_3, s_out)

def forward(x):
x = F.sigmoid(self.in_layer(x))
x = F.sigmoid(self.h1_layer(x))
x = F.sigmoid(self.h2_layer(x))
x = F.sigmoid(self.out_layer(x))
return x

model = neural_net(10, 1, 100, 50, 10)
print(model)