├── Tasks
├── daily tasks
│ ├── Issac_Antony
│ │ ├── .gitkeep
│ │ ├── a.gitkeep
│ │ ├── task_day2.py
│ │ └── day4_task.py
│ ├── GopikrishnanK
│ │ ├── .ipynb_checkpoints
│ │ │ ├── Day2_Task-checkpoint.ipynb
│ │ │ └── Day4_Task-checkpoint.ipynb
│ │ ├── Day2_Task.ipynb
│ │ └── Day4_Task.ipynb
│ ├── sreehari
│ │ └── day2.py
│ ├── gopi
│ │ └── day2.py
│ ├── basil
│ │ ├── day2.py
│ │ └── task3.ipynb
│ ├── Hashina
│ │ ├── day_2.py
│ │ └── day_4.py
│ ├── Abhinav K
│ │ └── day2_task.py
│ ├── Akhil G Krishnan
│ │ └── task2.py
│ ├── Paul Elias Sojan
│ │ ├── day2_task.py
│ │ └── task2.py
│ ├── Abhinav T B
│ │ └── day2.py
│ ├── Farhan_Najeeb
│ │ ├── day_2_task.py
│ │ └── day_4_task.py
│ ├── Mohammed Arshu
│ │ ├── task1.py
│ │ └── task2.py
│ ├── Fausan Asharaf
│ │ ├── task1.py
│ │ └── task2.py
│ ├── fazil_babu
│ │ ├── task1.py
│ │ └── task2.ipynb
│ ├── Shivani
│ │ └── task1.py
│ ├── Jamcey_V_P
│ │ ├── task1.py
│ │ └── task2.py
│ ├── Abhinav M Hari
│ │ ├── day_2_task.py
│ │ └── task 2.py
│ ├── Ashwin-Rajesh
│ │ └── Day2.py
│ ├── Akshay Narayanan
│ │ └── Day_2.py
│ ├── Ananthu Ajay
│ │ ├── day2.py
│ │ └── day4.py
│ ├── Hari Krishnan
│ │ ├── Day2-task.py
│ │ └── task2.py
│ ├── jishnu
│ │ └── task_d2.py
│ ├── lafith
│ │ └── day2.py
│ ├── Rinsa Fathima CM
│ │ ├── day2_task.py
│ │ └── task2.py
│ ├── Randheerrrk
│ │ ├── task1.py
│ │ └── day4.ipynb
│ ├── sreeraj
│ │ ├── day2.py
│ │ └── day4.py
│ ├── Jaseem ck
│ │ ├── Task_1.py
│ │ └── Task_2.ipynb
│ ├── Sourav_Menon
│ │ └── day_2.py
│ ├── Lija
│ │ └── day2Task.py
│ ├── Swathi
│ │ └── day_2_tensor multiplication
│ ├── Abhijeet
│ │ ├── task1.py
│ │ └── task2.py
│ ├── Allen K Abraham
│ │ ├── task_day_2.py
│ │ └── task2.ipynb
│ ├── Bharath.T.U
│ │ ├── task2.py
│ │ └── Day2_task.ipynb
│ ├── README.md
│ └── ranjith
│ │ ├── task2.ipynb
│ │ └── task1.ipynb
├── README.md
├── registration_task
│ ├── __pycache__
│ │ ├── main.cpython-38.pyc
│ │ └── test.cpython-38-pytest-5.4.3.pyc
│ └── README.md
├── KavyaV
│ └── day2.py
└── day2.py
├── resources
├── th_pytorch_reference.png
├── README.md
├── feedforward_net.py
└── cifar10cnn.py
├── .github
└── ISSUE_TEMPLATE.md
├── projects
└── README.md
└── README.md
/Tasks/daily tasks/Issac_Antony/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Issac_Antony/a.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Tasks/README.md:
--------------------------------------------------------------------------------
1 | # Tasks
2 | Tasks for every day will appear here!
3 |
--------------------------------------------------------------------------------
/resources/th_pytorch_reference.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tinkerhub/ComputerVision-with-PyTorch-Learning-Program/HEAD/resources/th_pytorch_reference.png
--------------------------------------------------------------------------------
/Tasks/daily tasks/GopikrishnanK/.ipynb_checkpoints/Day2_Task-checkpoint.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [],
3 | "metadata": {},
4 | "nbformat": 4,
5 | "nbformat_minor": 2
6 | }
7 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/GopikrishnanK/.ipynb_checkpoints/Day4_Task-checkpoint.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [],
3 | "metadata": {},
4 | "nbformat": 4,
5 | "nbformat_minor": 2
6 | }
7 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/sreehari/day2.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import numpy as np
3 | a=np.ones((5,3))
4 | b=np.ones((3,4))
5 | TTa=torch.from_numpy(a)
6 | TTb=torch.from_numpy(b)
7 | print (torch.mm(TTa,TTb))
--------------------------------------------------------------------------------
/Tasks/registration_task/__pycache__/main.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tinkerhub/ComputerVision-with-PyTorch-Learning-Program/HEAD/Tasks/registration_task/__pycache__/main.cpython-38.pyc
--------------------------------------------------------------------------------
/Tasks/daily tasks/gopi/day2.py:
--------------------------------------------------------------------------------
1 | import numpy
2 | import torch
3 | x = numpy.ones([5, 3])
4 | y = numpy.ones([3, 4])
5 | x_ = torch.from_numpy(x)
6 | y_ = torch.from_numpy(y)
7 | k = torch.matmul(x_, y_)
8 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/basil/day2.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import numpy as np
3 | a=np.random.rand(5,3)
4 | b=np.random.rand(3,4)
5 | tensor_a=torch.from_numpy(a)
6 | tensor_b=torch.from_numpy(b)
7 | print(torch.mm(tensor_a,tensor_b))
8 |
--------------------------------------------------------------------------------
/Tasks/registration_task/__pycache__/test.cpython-38-pytest-5.4.3.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tinkerhub/ComputerVision-with-PyTorch-Learning-Program/HEAD/Tasks/registration_task/__pycache__/test.cpython-38-pytest-5.4.3.pyc
--------------------------------------------------------------------------------
/Tasks/daily tasks/Hashina/day_2.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import numpy as np
3 | x = np.random.rand(5, 3)
4 | y = np.random.rand(3, 4)
5 | xt = torch.from_numpy(x)
6 | yt = torch.from_numpy(y)
7 | mul = torch.matmul(xt, yt)
8 | print(mul)
9 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Abhinav K/day2_task.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import torch
3 |
4 | a=np.random.rand(5,3)
5 | b=np.random.rand(3,4)
6 | a2=torch.from_numpy(a)
7 | b2=torch.from_numpy(b)
8 |
9 | c=torch.mm(a2,b2)
10 | print(c)
11 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Akhil G Krishnan/task2.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import torch
3 |
4 |
5 | a = np.empty((5, 3))
6 | b = np.empty((3, 4))
7 | a = torch.from_numpy(a)
8 | b = torch.from_numpy(b)
9 | c = torch.mm(a, b)
10 | print(c)
11 |
--------------------------------------------------------------------------------
/Tasks/KavyaV/day2.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import numpy as np
3 |
4 | np_arr1 = np.arange(15).reshape(5,3)
5 | np_arr2 = np.arange(12).reshape(3,4)
6 | tensor1 = torch.from_numpy(np_arr1)
7 | tensor2 = torch.from_numpy(np_arr2)
8 | print(torch.matmul(tensor1,tensor2))
9 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Paul Elias Sojan/day2_task.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import torch
3 |
4 | arr1=np.random.rand(5,3)
5 | arr2=np.random.rand(3,4)
6 |
7 | t1=torch.from_numpy(arr1)
8 | t2=torch.from_numpy(arr2)
9 |
10 | print(torch.matmul(t1,t2))
11 |
12 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Abhinav T B/day2.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import torch
3 |
4 |
5 | a = np.empty((5, 3))
6 | b = np.empty((3, 4))
7 |
8 |
9 | a = torch.from_numpy(a)
10 | b = torch.from_numpy(b)
11 |
12 |
13 | c = torch.mm(a, b)
14 |
15 | print(c)
16 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Farhan_Najeeb/day_2_task.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import numpy as np
3 |
4 |
5 | x = np.ones((5, 3))
6 | print(x)
7 | y = np.random.randn(3, 4)
8 | print(y)
9 | x = torch.from_numpy(x)
10 | y = torch.from_numpy(y)
11 | print(torch.mm(x, y))
12 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Mohammed Arshu/task1.py:
--------------------------------------------------------------------------------
1 | from __future__ import print_function
2 | import torch
3 | import numpy as np
4 | a = np.random.rand(5,3)
5 | b = np.random.rand(3,4)
6 | c = torch.from_numpy(a)
7 | d = torch.from_numpy(b)
8 | e = torch.mm(c,d)
9 | print(e)
10 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Fausan Asharaf/task1.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import torch
3 |
4 | a = np.random.randint(10, size=(5, 3))
5 | b = np.random.randint(10, size=(3, 4))
6 | a_t = torch.from_numpy(a)
7 | b_t = torch.from_numpy(b)
8 |
9 | c_t = torch.matmul(a_t, b_t)
10 | print(c_t)
11 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/fazil_babu/task1.py:
--------------------------------------------------------------------------------
1 | # Done on day 2
2 |
3 | import torch
4 | import numpy as np
5 |
6 | arr1 = np.random.randn(5, 3)
7 | arr2 = np.random.randn(3, 4)
8 |
9 | arr1_t = torch.tensor(arr1)
10 | arr2_t = torch.tensor(arr2)
11 |
12 | print(torch.matmul(arr1_t, arr2_t))
--------------------------------------------------------------------------------
/Tasks/daily tasks/Shivani/task1.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import torch
3 | x = np.random.rand(5,3)
4 | print(x)
5 | y = np.random.rand(3,4)
6 | print(y)
7 | xt = torch.from_numpy(x)
8 | print(xt)
9 | yt = torch.from_numpy(y)
10 | print(yt)
11 | result = torch.mm(xt,yt)
12 | print(result)
13 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Jamcey_V_P/task1.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import numpy as np
3 |
4 | a =np.random.randint(5,size = (5,3))
5 | b =np.random.randint(5,size = (3,4))
6 | a_tensor = torch.from_numpy(a)
7 | b_tensor = torch.from_numpy(b)
8 | result = torch.matmul(a_tensor,b_tensor)
9 | print(result)
10 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Abhinav M Hari/day_2_task.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import torch
3 |
4 | #creating numpy arrays
5 | x = np.zeros([5, 3])
6 | y = np.ones([3, 4])
7 |
8 | #converting to tensors
9 | x_ = torch.from_numpy(x)
10 | y = torch.from_numpy(y)
11 |
12 | #Multiplying the tensors
13 | z = torch.matmul(x_, y_)
14 | print(z)
15 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Ashwin-Rajesh/Day2.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python3.7
2 |
3 | import numpy as np
4 | import torch
5 |
6 | np.random.seed(0)
7 |
8 | array_a = np.random.randn(5,3)
9 | array_b = np.random.randn(3,4)
10 |
11 | tensor_a = torch.tensor(array_a)
12 | tensor_b = torch.tensor(array_b)
13 |
14 | print(tensor_a.matmul(tensor_b))
15 |
--------------------------------------------------------------------------------
/Tasks/day2.py:
--------------------------------------------------------------------------------
1 | from __future__ import absolute_import
2 | from __future__ import division
3 | from __future__ import print_function
4 | import torch
5 |
6 | import numpy as np
7 | x = np.random.random((5,3))
8 | y = np.random.random((3,4))
9 | a= torch.from_numpy(x)
10 | b = torch.from_numpy(y)
11 |
12 | t=torch.mm(a,b)
13 |
14 | print(t)
15 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Akshay Narayanan/Day_2.py:
--------------------------------------------------------------------------------
1 | from __future__ import print_function
2 | import numpy as np
3 |
4 | import torch
5 |
6 | p=np.random.random((5,3))
7 | q=np.random.random((3,4))
8 | x=torch.from_numpy(p)
9 | y=torch.from_numpy(q)
10 |
11 | product=torch.matmul(x,y)
12 | print("The product of 5x3 and 3x4 tensor are >> \n ......\n",product)
13 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Ananthu Ajay/day2.py:
--------------------------------------------------------------------------------
1 | from __future__ import absolute_import
2 | from __future__ import division
3 | from __future__ import print_function
4 | import torch
5 |
6 | import numpy as np
7 | x = np.random.random((5,3))
8 | y = np.random.random((3,4))
9 | a= torch.from_numpy(x)
10 | b = torch.from_numpy(y)
11 |
12 | t=torch.mm(a,b)
13 |
14 | print(t)
15 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Hari Krishnan/Day2-task.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import torch
3 |
4 | # Creating numpy array of the specified type
5 | a = np.empty((5, 3))
6 | b = np.empty((3, 4))
7 |
8 | # Converting numpy array to Torch tensors
9 | a = torch.from_numpy(a)
10 | b = torch.from_numpy(b)
11 |
12 | # Multiplying two tensors
13 | c = torch.mm(a, b)
14 |
15 | print(c)
16 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/jishnu/task_d2.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import torch
3 |
4 | np.random.seed(0)
5 |
6 | #creating two random numpy arrays
7 | arr_a = np.random.randn(5,3)
8 | arr_b = np.random.randn(3,4)
9 |
10 | #converting numpy array to torch tensors
11 | tensor_a = torch.tensor(arr_a)
12 | tensor_b = torch.tensor(arr_b)
13 |
14 | print(tensor_a.matmul(tensor_b))
15 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/lafith/day2.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import numpy as np
3 |
4 | #Create two numpy arrays of size 5x3 and 3x4
5 | a=np.random.rand(5,3)
6 | b=np.random.rand(3,4)
7 | #Convert them into torch tensors
8 | a_t = torch.from_numpy(a)
9 | b_t = torch.from_numpy(b)
10 | #Multiply the two tensors and print the result
11 | result=torch.matmul(a_t,b_t)
12 | print(result)
13 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Rinsa Fathima CM/day2_task.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import torch
3 |
4 | #creating numpy arrays
5 | a=np.random.randint(15,size=(5,3))
6 | b=np.random.randint(5,size=(3,4))
7 |
8 | #converting numpy arrays to torch tensors
9 | c=torch.from_numpy(a)
10 | d=torch.from_numpy(b)
11 |
12 | #multiplying torch tensors
13 | product=torch.mm(c,d)
14 | print(product)
15 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Issac_Antony/task_day2.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import numpy as np
3 |
4 | a_numpy = np.random.randn(5, 3)
5 | b_numpy = np.ones((3, 4), dtype=float)
6 |
7 | print(a_numpy)
8 | print(b_numpy)
9 |
10 | a_torch = torch.from_numpy(a_numpy)
11 | b_torch = torch.from_numpy(b_numpy)
12 |
13 | print(a_torch)
14 | print(b_torch)
15 |
16 | mul = torch.mm(a_torch, b_torch)
17 | print(mul)
18 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Randheerrrk/task1.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """task1
3 |
4 | Automatically generated by Colaboratory.
5 |
6 | Original file is located at
7 | https://colab.research.google.com/drive/1KiNRo7ltyENDERowPkIDEJ1uWrDw2h4n
8 | """
9 |
10 | import torch as pt
11 | import numpy as np
12 |
13 | print(pt.matmul(pt.from_numpy(np.random.randn(5, 3)), pt.from_numpy(np.random.randn(3, 4))))
--------------------------------------------------------------------------------
/Tasks/daily tasks/sreeraj/day2.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import torch
3 |
4 | x = np.random.rand(5,3) #created numpy array of shape 5,3 with random values
5 | y = np.random.rand(3,2) #created numpy array of shape 3,2 with random values
6 | a = torch.from_numpy(x) #converted numpy array into torch tensor
7 | b = torch.from_numpy(y)
8 | z = torch.matmul(a,b) #multiplied the 2 torch tensors
9 | print(z)
10 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Jaseem ck/Task_1.py:
--------------------------------------------------------------------------------
1 | import torch as th
2 | import numpy as np
3 |
4 | #numpy of size 5*3
5 | a = np.arange(15).reshape(5,3)
6 | #numpy of size 3*4
7 | b = np.arange(12).reshape(3,4)
8 |
9 | #Converting numpy arrays into tensors
10 | a_torch = th.from_numpy(a)
11 | b_torch = th.from_numpy(b)
12 |
13 | #Multiply the tensors to generate the product
14 | product = th.mm(a_torch, b_torch)
15 |
16 | print(product)
17 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Sourav_Menon/day_2.py:
--------------------------------------------------------------------------------
1 | import numpy
2 | import torch
3 |
4 | #creating numpy array of dim-(5,3)
5 | array_1=numpy.random.rand(5,3)
6 |
7 | #creating numpy array of dim-(3,4)
8 | array_2=numpy.random.rand(3,4)
9 |
10 | #converting arrays into torch tensor
11 | a=torch.from_numpy(array_1)
12 | b=torch.from_numpy(array_2)
13 |
14 | #printing the prouduct of 2 torch tensors
15 |
16 | print(torch.matmul(a,b))
17 |
18 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Abhinav M Hari/task 2.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn as nn
3 |
4 | class Net(nn.Module):
5 | def __init__(self):
6 | super(Net, self). __init__()
7 | self.layer1 = nn.Linear(120, 84)
8 | self.layer2 = nn.Linear(84, 10)
9 |
10 | def forward(self, x):
11 | x = self.layer1(x)
12 | x = torch.sigmoid(self.layer2(x))
13 |
14 | net = Net()
15 | input = torch.randn(120)
16 | output = net(input)
17 | print(output)
18 |
19 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Lija/day2Task.py:
--------------------------------------------------------------------------------
1 |
2 |
3 | #Create two numpy arrays of size 5x3 and 3x4.
4 | #Convert them into torch tensors.
5 | #Multiply the two tensors and print the result.
6 |
7 | import torch
8 | import numpy as np
9 |
10 | array1=np.random.rand(5,3)
11 | array2=np.random.rand(3,4)
12 |
13 | tensor1=torch.from_numpy(array1)
14 | tensor2=torch.from_numpy(array2)
15 | z=tensor1@tensor2
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Hashina/day_4.py:
--------------------------------------------------------------------------------
1 | from torch import nn
2 |
3 | class Network(nn.Module):
4 | def __init__(self):
5 | super().__init__()
6 |
7 | self.hidden = nn.Linear(1, 2)
8 | self.output = nn.Linear(2, 1)
9 |
10 | self.sigmoid = nn.Sigmoid()
11 |
12 | def forward(self, x):
13 | x = self.hidden(x)
14 | x = self.sigmoid(x)
15 | x = self.output(x)
16 |
17 | return x
18 |
19 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Swathi/day_2_tensor multiplication:
--------------------------------------------------------------------------------
1 | """
2 | Create two numpy arrays of size 5x3 and 3x4.
3 | Convert them into torch tensors.
4 | Multiply the two tensors and print the result.
5 |
6 | """
7 |
8 | from __future__ import print_function
9 | import torch
10 | import numpy as np
11 | import random
12 |
13 | x = np.random.randn(5, 3)
14 | y = np.random.randn(3, 4)
15 | x1 = torch.from_numpy(x)
16 | y1 = torch.from_numpy(y)
17 |
18 | result = torch.matmul(x1, y1)
19 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Abhijeet/task1.py:
--------------------------------------------------------------------------------
1 | #Day2
2 | # Playing around with tensors
3 |
4 | # 1. Create two numpy arrays of size 5x3 and 3x4.
5 | # 2. Convert them into torch tensors.
6 | # 3. Multiply the two tensors and print the result.
7 |
8 |
9 | import numpy as np
10 | import torch as tp
11 |
12 | a= np.random.rand(5, 3)
13 | b=np.random.rand(3, 4)
14 | a=tp.tensor(a)
15 | b=tp.tensor(b)
16 | print(a.size())
17 | print(b.size())
18 | Multipli_tensor=tp.mm(a,b)
19 | print("Multipli_tensor\n",Multipli_tensor)
20 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Allen K Abraham/task_day_2.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import torch
3 |
4 | def main():
5 |
6 | # Initialization of numpy arrays
7 | arrayOne = np.random.randint(10, size=(5, 3))
8 | arrayTwo = np.random.randint(5, size=(3, 4))
9 |
10 | # Converting numpy arrays to torch tensors
11 | tensorArrayOne = torch.from_numpy(arrayOne)
12 | tensorArrayTwo = torch.from_numpy(arrayTwo)
13 |
14 | # Multiplying two tensors
15 | tensorResult = torch.matmul(tensorArrayOne, tensorArrayTwo)
16 |
17 | print(tensorResult)
18 |
19 |
20 | if __name__ == "__main__":
21 | main()
--------------------------------------------------------------------------------
/Tasks/daily tasks/Rinsa Fathima CM/task2.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn as nn
3 |
4 | class Net(nn.Module):
5 | def __init__(self):
6 | super(Net,self).__init__()
7 | self.input=nn.Linear(400,200)
8 | self.hidden1=nn.Linear(200,100)
9 | self.sigmoid=nn.Sigmoid()
10 | self.hidden2=nn.Linear(100,50)
11 | self.output=nn.Linear(50,25)
12 |
13 | def forward(self,x):
14 | x=self.input(x)
15 | x=self.hidden1(x)
16 | x=self.sigmoid(x)
17 | x=self.hidden2(x)
18 | x=self.output(x)
19 | return x
20 | model=Net()
21 | print(model)
--------------------------------------------------------------------------------
/Tasks/daily tasks/Paul Elias Sojan/task2.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn as nn
3 |
4 |
5 | class NeuralNetwork(nn.Module):
6 | def __init__(self):
7 | super(NeuralNetwork, self).__init__()
8 | self.input = nn.Linear(28*28,100)
9 | self.fc1 = nn.Linear(100, 200)
10 | self.sigmoid = nn.Sigmoid()
11 | self.fc2 = nn.Linear(200, 50)
12 | self.out = nn.Linear(50,10)
13 |
14 | def forward(self,x):
15 | x=self.input(x)
16 | x = self.sigmoid(self.fc1(x))
17 | x=self.sigmoid(self.fc2(x))
18 | x=self.out(x)
19 |
20 |
21 | n = NeuralNetwork()
22 | print(n)
23 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Abhijeet/task2.py:
--------------------------------------------------------------------------------
1 | import torch.nn as nn
2 |
3 | import torch
4 |
5 | class Network(nn.Module):
6 | def __init__(self,N_in,N_out):
7 | super(Network, self).__init__()
8 | self.input = nn.Linear(N_in, 500)
9 | self.fc1 = nn.Linear(500, 120)
10 | self.fc2 = nn.Linear(120, 84)
11 | self.Output = nn.Linear(84, N_out)
12 | self.sigmoid = nn.Sigmoid()
13 |
14 |
15 | def forward(self, x):
16 | x=self.input(x)
17 | x= self.fc1(x)
18 | x = self.sigmoid(x)
19 | x=self.fc2(x)
20 | x = self.Output(x)
21 | return x
22 |
23 |
24 | net = Network(600,10)
25 | print(net)
26 |
27 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Fausan Asharaf/task2.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn as nn
3 |
4 |
5 | class Net(nn.Module):
6 | def __init__(self, D_in, D_out):
7 | super(Net, self).__init__()
8 | self.input = nn.Linear(D_in, 500)
9 | self.sigmoid = nn.Sigmoid()
10 | self.h1 = nn.Linear(500, 200)
11 | self.h2 = nn.Linear(200, 100)
12 | self.output = nn.Linear(100, D_out)
13 |
14 | def forward(self, x):
15 | x = self.input(x)
16 | x = self.sigmoid(self.h1(x))
17 | x = self.h2(x)
18 | x = self.output(x)
19 | return x
20 |
21 |
22 | model = Net(D_in=784, D_out=10)
23 | print(model)
24 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Bharath.T.U/task2.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn as nn
3 | class Net(nn.Module):
4 |
5 | def __init__(self,n_in,n_out):
6 | super(Net, self).__init__()
7 | self.in_layer = nn.Linear(n_in, 512)
8 | self.h1_layer = nn.Linear(512, 256)
9 | self.h2_layer = nn.Linear(256, 128)
10 | self.out_layer = nn.Linear(128, n_out)
11 | self.activation = nn.Sigmoid()
12 |
13 | def forward(self, x):
14 | x = self.in_layer(x)
15 | x = self.h1_layer(x)
16 | x = self.activation(x)
17 | x = self.h2_layer(x)
18 | x = self.out_layer(x)
19 | return x
20 | net = Net(1024,64)
21 | print(net)
22 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ## Specific Question
2 | > Ask your question here.
3 | ## OS, package manager and PyTorch Version
4 | > Add the following details.
5 | * OS -
6 | * PyTorch Version -
7 | * Package Manager -
8 |
9 | ## Complete Error Log
10 | > Add your error log here
11 |
12 | 👇🏿 Remove these guidelines before filing the issue.
13 | ## Guidelines
14 |
15 | > Please google/duckduckgo before asking here
16 |
17 | ❗ Please ask specific questions. Check how to ask [smart questions](http://catb.org/~esr/faqs/smart-questions.html) before filing the issue
18 |
19 | Mention your operating system, package manager, pytorch version with the question you asked
20 |
21 | 🐛 Add the complete log of error message with source code, if you are asking to help fix a specific bug/problem you encountered.
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Hari Krishnan/task2.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn as nn
3 |
4 |
5 | class Net(nn.Module):
6 | def __init__(self):
7 | super(Net, self).__init__()
8 | self.input = nn.Linear(784, 392)
9 | self.hidden1 = nn.Linear(392, 98)
10 | self.sigmoid = nn.Sigmoid()
11 | self.hidden2 = nn.Linear(98, 14)
12 | self.output = nn.Linear(14, 3)
13 |
14 | def forward(self, x):
15 | x = self.input(x)
16 | x = self.hidden1(x)
17 | x = self.sigmoid(x)
18 | x = self.hidden2(x)
19 | x = self.output(x)
20 | return x
21 |
22 | def num_flat_features(self, x):
23 | size = x.size()[1:]
24 | num_features = 1
25 | for s in size:
26 | num_features *= s
27 | return num_features
28 |
29 |
30 | model = Net()
31 | print(model)
32 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Ananthu Ajay/day4.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn as nn
3 | import torch.nn.functional as F
4 |
5 |
6 | class Net(nn.Module):
7 |
8 | def __init__(self):
9 | super(Net, self).__init__()
10 | self.conv1 = nn.Conv2d(1, 4, 4)
11 | self.conv2 = nn.Conv2d(4, 16, 4)
12 | self.fc1 = nn.Linear(16 * 4 * 4, 120)
13 | self.fc2 = nn.Linear(120, 10)
14 |
15 | def forward(self, x):
16 | x = F.max_pool2d(F.sigmoid(self.conv1(x)), (2, 2))
17 | x = F.max_pool2d(F.sigmoid(self.conv2(x)), 2)
18 | x = x.view(-1, self.num_flat_features(x))
19 | x = F.sigmoid(self.fc1(x))
20 | x = self.fc2(x)
21 | return x
22 |
23 | def num_flat_features(self, x):
24 | size = x.size()[1:]
25 | num_features = 1
26 | for s in size:
27 | num_features *= s
28 | return num_features
29 |
30 |
31 | net = Net()
32 | print(net)
33 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Issac_Antony/day4_task.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn as nn
3 | import torch.nn.functional as F
4 |
5 |
6 | class Net(nn.Module):
7 |
8 | def __init__(self):
9 | super(Net, self).__init__()
10 | self.conv1 = nn.Conv2d(1, 6, 5)
11 | self.conv2 = nn.Conv2d(6, 16, 5)
12 | self.fc1 = nn.Linear(16 * 5 * 5, 120)
13 | self.fc2 = nn.Linear(120, 10)
14 |
15 | def forward(self, x):
16 | x = F.max_pool2d(F.sigmoid(self.conv1(x)), (2, 2))
17 | x = F.max_pool2d(F.sigmoid(self.conv2(x)), 2)
18 | x = x.view(-1, self.num_flat_features(x))
19 | x = F.sigmoid(self.fc1(x))
20 | x = self.fc2(x)
21 | return x
22 |
23 | def num_flat_features(self, x):
24 | size = x.size()[1:]
25 | num_features = 1
26 | for s in size:
27 | num_features *= s
28 | return num_features
29 |
30 |
31 | net = Net()
32 | print(net)
33 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Farhan_Najeeb/day_4_task.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn as nn
3 | import torch.nn.functional as F
4 |
5 |
6 | class Net(nn.Module):
7 |
8 | def __init__(self):
9 | super(Net, self).__init__()
10 | self.conv1 = nn.Conv2d(1, 6, 5)
11 | self.conv2 = nn.Conv2d(6, 16, 5)
12 | self.fc1 = nn.Linear(16 * 5 * 5, 120)
13 | self.fc2 = nn.Linear(120, 10)
14 |
15 | def forward(self, x):
16 | x = F.max_pool2d(F.sigmoid(self.conv1(x)), (2, 2))
17 | x = F.max_pool2d(F.sigmoid(self.conv2(x)), 2)
18 | x = x.view(-1, self.num_flat_features(x))
19 | x = F.sigmoid(self.fc1(x))
20 | x = self.fc2(x)
21 | return x
22 |
23 | def num_flat_features(self, x):
24 | size = x.size()[1:]
25 | num_features = 1
26 | for s in size:
27 | num_features *= s
28 | return num_features
29 |
30 |
31 | net = Net()
32 | print(net)
33 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/sreeraj/day4.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn as nn
3 | import torch.optim as optim
4 |
5 | class Net(nn.Module):
6 | def __init__(self):
7 | super().__init__()
8 | self.h1 = nn.Linear(3, 6)
9 | self.h2 = nn.Linear(6, 6)
10 | self.op = nn.Linear(6, 1)
11 | self.sigmoid = nn.Sigmoid()
12 |
13 |
14 | def forward(self, x):
15 | x = self.sigmoid(self.h1(x))
16 | x = self.sigmoid(self.h2(x))
17 | x = self.op(x)
18 | return x
19 |
20 |
21 | ip = torch.randn(4, 3)
22 | op = torch.randn(4, 1)
23 |
24 | model = Net()
25 | epoch = 10000
26 | optimizer = optim.SGD(model.parameters(), lr=0.01)
27 | criterion = nn.MSELoss()
28 |
29 | for i in range(epoch):
30 | out = model(ip)
31 | loss = criterion(out, op)
32 | model.zero_grad()
33 | loss.backward()
34 | optimizer.step()
35 |
36 | print("Loss : ", loss)
37 | print("Prediction : ", out)
38 |
--------------------------------------------------------------------------------
/projects/README.md:
--------------------------------------------------------------------------------
1 | # Projects
2 | Going throught the curated content and tasks you learnt pytorch and computervision. Now is the time to do a project to validate your learning. Follow the following steps to get started with projects.
3 |
4 | ## Guidelines
5 | ### Idea selection
6 | - The problem statement should be a computer vision task.
7 | - You can collect dataset from the internet or collect your own dataset.
8 |
9 | ### Teaming up
10 | - Teaming up is optional. If interested you can form teams talking to your fellow students.
11 |
12 | ### Idea presentation and working
13 | Create a github repo for your project. In the README file add the following details
14 | 1. Project name
15 | 2. Brief description about the project
16 | 3. Info about the dataset (source, format, amount..etc)
17 | 4. Info about the model you are going to be used.
18 |
19 |
20 | Update your details in this [teams form](https://bit.ly/TH_PyTorchProject). Mentor will evaluate your project and give necessary feedbacks.
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/resources/README.md:
--------------------------------------------------------------------------------
1 | # Resources to warm up before the PyTorch Learning Program
2 | You need to know the following stuffs to get started with the PyTorch Learning Program. If you are new here, worry not. You can go through the resources given below and apply for the program!
3 |
4 | ## Object Oriented Python Programming
5 | - [Python classes and objects(tutorials point)](https://www.tutorialspoint.com/python/python_classes_objects.htm)
6 | - [Introduction to OOP by Sentdex](https://pythonprogramming.net/object-oriented-programming-introduction-intermediate-python-tutorial/)
7 |
8 | ## Git and GitHub
9 | - [GitHub Beginner](https://www.notion.so/GitHub-Beginner-34ddb2bdd2054224bd31c24ce84d64f1)
10 | - [GitHub Advanced](https://www.notion.so/GitHub-Advanced-dc2b226421464ccc8b58b2a2d7b333db)
11 |
12 | ## Basics of Machine Learning
13 | - [Machine Learning Intro part 1](https://www.notion.so/0tinkerhub/Machine-Learning-Beginner-60c58689ed454319ab6a1c4019a8c295)
14 | - [Machine Learning Intro part 2](https://www.notion.so/0tinkerhub/Machine-Learning-Advanced-5156f313eab14b1bbb84cfd87c5a892e)
15 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Mohammed Arshu/task2.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn as nn
3 | import torch.optim as optim
4 |
5 | class Net(nn.Module):
6 | def __init__(self):
7 | super(Net, self).__init__()
8 | self.inputSize = 3
9 | self.outputSize = 1
10 | self.input = nn.Linear(self.inputSize, 10)
11 | self.sigmoid = nn.Sigmoid()
12 | self.hidden = nn.Linear(10, 15)
13 | self.output = nn.Linear(15, self.outputSize)
14 | def forward(self, X):
15 | X = self.sigmoid(self.input(X))
16 | X = self.sigmoid(self.hidden(X))
17 | X = self.sigmoid(self.output(X))
18 | return X
19 |
20 | net = Net()
21 | print(net)
22 |
23 | X=torch.randn(3,3)
24 | Y=torch.tensor(
25 | [
26 | [1.0],
27 | [1.0],
28 | [0.0]
29 | ]
30 | )
31 |
32 | net.zero_grad()
33 | criterion = nn.MSELoss()
34 | optimizer = optim.SGD(net.parameters(), lr=0.01)
35 |
36 | for i in range(10000):
37 | output = net(X)
38 | loss = criterion(output,Y)
39 | print(loss)
40 | loss.backward()
41 | optimizer.step()
42 |
43 | print(net(X))
44 | print(Y)
--------------------------------------------------------------------------------
/Tasks/registration_task/README.md:
--------------------------------------------------------------------------------
1 | # The Short Listing task
2 |
3 | Inside the ```main.py``` there is a class LinearRegression() Implement it using python and numpy. After finishing the task don't forget to fill the [application form](https://forms.gle/MVbuAjQxWazsmbMw6).
4 | ## Requirements
5 |
6 | 1. The class should have methods fit() and predict()
7 | 2. You will be shortlisted based on the code passing the test case in ```test.py```
8 | 3. You can write the class and run,
9 | ```
10 | pytest test.py
11 | ```
12 | to test if your code works.
13 |
14 | ## Steps
15 | 1. Create a private repo in your github.
16 | 2. Copy the code of ```main.py```, ```test.py``` and ```setup.py``` to corresponding ```main.py```, ```test.py``` and ```setup.py``` in your private repo.
17 | 3. Run ```python setup.py install``` for installing numpy and pytest
18 | 4. Finish the LinearRegression class.
19 | 5. Invite [Gopi](github.com/GopikrishnanSasikumar) to your repo.
20 | 6. Fill the [application form](https://forms.gle/MVbuAjQxWazsmbMw6) with your repo url.
21 |
22 | You can use this [reference](https://machinelearningmastery.com/implement-simple-linear-regression-scratch-python/).
23 |
24 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Jamcey_V_P/task2.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn as nn
3 |
4 | class neural_network(nn.Module):
5 | def __init__(self, ):
6 | super(neural_network, self).__init__()
7 |
8 | self.input_layer = 4 # Number of input units
9 | self.hidden_layer1 = 5 # Number of hidden units
10 | self.hidden_layer2 = 3 # Number of hidden units
11 | self.output_layer = 1 # Number of output units
12 |
13 | # Weights
14 | W1 = torch.randn(self.input_layer, self.hidden_layer1)
15 | W2 = torch.randn(self.hidden_layer1, self.hidden_layer2)
16 | W3 = torch.randn(self.hidden_layer2, self.output_layer)
17 |
18 |
19 | # bias
20 | B1 = torch.randn((1, self.hidden_layer1))
21 | B2 = torch.randn((1,self.hidden_layer2))
22 | B3 = torch.randn((1,self.output_layer))
23 |
24 | def forward(self, X):
25 | z1 = torch.mm(X, w1) + b1
26 | Relu = nn.ReLU()
27 | a1 = Relu(z1)
28 | z2 = torch.mm(X, w2) + b2
29 | Relu = nn.ReLU()
30 | a2 = Relu(z2)
31 | z3 = torch.mm(X, w3) + b3
32 | Sigmoid = nn.Sigmoid()
33 | Result = Sigmoid(z3)
34 | return Result
35 |
--------------------------------------------------------------------------------
/resources/feedforward_net.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn as nn
3 | import torch.optim as optim
4 | from torch.utils.tensorboard import SummaryWriter
5 | writer = SummaryWriter('runs/dummy_model')
6 | x = torch.tensor([[0,0,1],[0,1,1],[1,0,1],[1,1,1]]).float()
7 | y = torch.tensor([[0], [1], [1], [0]]).float()
8 | class Net(nn.Module):
9 | def __init__(self, inp, out):
10 | super(Net, self).__init__()
11 | self.input = nn.Linear(inp, 4)
12 | self.sigmoid = nn.Sigmoid()
13 | self.h1 = nn.Linear(4, 8)
14 | self.h2 = nn.Linear(8, 16)
15 | self.output = nn.Linear(16, out)
16 |
17 | def forward(self, x):
18 | x = self.input(x)
19 | x = self.sigmoid(self.h1(x))
20 | x = self.h2(x)
21 | x = self.output(x)
22 | return x
23 |
24 |
25 | model = Net(inp=3, out=1)
26 | for name, param in model.named_parameters():
27 | if param.requires_grad:
28 | print(name)
29 | #print(model.forward(x))
30 | #print(model.forward(torch.tensor([[0, 0, 1]]).float()))
31 | model.zero_grad()
32 | criterion = nn.MSELoss()
33 | optimr = optim.SGD(model.parameters(), lr=0.001)
34 | for i in range(60000):
35 | output = model(x)
36 | target_ = y
37 | loss = criterion(output, target_)
38 | print(loss)
39 | loss.backward()
40 | optimr.step()
41 |
42 | print(model(x))
43 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/README.md:
--------------------------------------------------------------------------------
1 | # Daily Tasks
2 | Daily tasks for TinkerHub PyTorch Learning program.
3 |
4 | # Guidelines
5 | Use the following steps to participate in the daily tasks.
6 |
7 | * Create a folder with your name in the daily tasks sub repo if it doesn't exist.
8 | * Complete each of the task given in the tasks session.
9 | * Push your code to your folder.
10 | * You can use jupyter notebook or .py files for the tasks.
11 |
12 | # Tasks
13 |
14 | ## Task 1
15 | Day 1 was fun!
16 |
17 | ## Task 2
18 | ### Playing around with tensors
19 | 1. Create two numpy arrays of size 5x3 and 3x4.
20 | 2. Convert them into torch tensors.
21 | 3. Multiply the two tensors and print the result.
22 |
23 | ## Task 3
24 | ### Create a neural network using pytorch
25 | Create a neural network with the following configurations
26 | 1. An input layer.
27 | 2. Two hidden layers.
28 | 3. An output layer.
29 | 4. torch.nn.Sigmoid functions in between hidden layers.
30 |
31 | ## Task 4
32 | ### Tweak the hyperparameters
33 | 1. Check out the [cifar10cnn.py](https://github.com/tinkerhub-org/ComputerVision-with-PyTorch-Learning-Program/blob/master/resources/cifar10cnn.py).
34 | 2. Tweak the values of hyperparameters like number of output channels, kernel size, learning rate..etc
35 | 3. Note how the accuracy and loss changed on tweaking those params as a comment in your code.
36 |
37 | ## Task 5
38 | ### Play around with Pytorch Transforms.
39 | 1. Load a set of images from the internet (Be kind and empathetic. Don't use explicit contents)
40 | 2. You can use library like [PIL](https://pypi.org/project/Pillow/)
41 | 3. Go to [pytorch transforms documentation](https://pytorch.org/docs/stable/torchvision/transforms.html) here.
42 | 4. Apply various transformations and see the results.
43 | 5. You can use Jupyter notebooks!
44 |
45 |
46 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/fazil_babu/task2.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": 229,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "# Task given on day 4\n",
10 | "\n",
11 | "import torch\n",
12 | "from torch import nn"
13 | ]
14 | },
15 | {
16 | "cell_type": "code",
17 | "execution_count": 230,
18 | "metadata": {},
19 | "outputs": [],
20 | "source": [
21 | "model = nn.Sequential(\n",
22 | " nn.Linear(784, 8),\n",
23 | " nn.Sigmoid(),\n",
24 | " nn.Linear(8, 8),\n",
25 | " nn.Sigmoid(),\n",
26 | " nn.Linear(8, 8),\n",
27 | " nn.Sigmoid(),\n",
28 | " nn.Linear(8, 10),\n",
29 | " nn.Softmax()\n",
30 | ")"
31 | ]
32 | },
33 | {
34 | "cell_type": "code",
35 | "execution_count": 231,
36 | "metadata": {},
37 | "outputs": [
38 | {
39 | "output_type": "execute_result",
40 | "data": {
41 | "text/plain": "Sequential(\n (0): Linear(in_features=784, out_features=8, bias=True)\n (1): Sigmoid()\n (2): Linear(in_features=8, out_features=8, bias=True)\n (3): Sigmoid()\n (4): Linear(in_features=8, out_features=8, bias=True)\n (5): Sigmoid()\n (6): Linear(in_features=8, out_features=10, bias=True)\n (7): Softmax(dim=None)\n)"
42 | },
43 | "metadata": {},
44 | "execution_count": 231
45 | }
46 | ],
47 | "source": [
48 | "model"
49 | ]
50 | }
51 | ],
52 | "metadata": {
53 | "language_info": {
54 | "codemirror_mode": {
55 | "name": "ipython",
56 | "version": 3
57 | },
58 | "file_extension": ".py",
59 | "mimetype": "text/x-python",
60 | "name": "python",
61 | "nbconvert_exporter": "python",
62 | "pygments_lexer": "ipython3",
63 | "version": "3.8.2-final"
64 | },
65 | "orig_nbformat": 2,
66 | "kernelspec": {
67 | "name": "python38264bit88c5656e839e4b9dbfc47071a86401a2",
68 | "display_name": "Python 3.8.2 64-bit"
69 | }
70 | },
71 | "nbformat": 4,
72 | "nbformat_minor": 2
73 | }
--------------------------------------------------------------------------------
/Tasks/daily tasks/GopikrishnanK/Day2_Task.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": 13,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "import torch\n",
10 | "import numpy as np\n",
11 | "\n",
12 | "arr1 = np.array([[1,2,3],[4,5,6],[7,8,9],[10,11,12],[13,14,15]])\n",
13 | "arr2 = np.array([[3,4,5,6],[7,8,9,10],[11,12,13,14]])\n",
14 | "\n"
15 | ]
16 | },
17 | {
18 | "cell_type": "code",
19 | "execution_count": 16,
20 | "metadata": {},
21 | "outputs": [
22 | {
23 | "name": "stdout",
24 | "output_type": "stream",
25 | "text": [
26 | "tensor([[ 3, 4, 5, 6],\n",
27 | " [ 7, 8, 9, 10],\n",
28 | " [11, 12, 13, 14]], dtype=torch.int32)\n"
29 | ]
30 | }
31 | ],
32 | "source": [
33 | "tens1 = torch.from_numpy(arr1)\n",
34 | "tens2 = torch.from_numpy(arr2)\n",
35 | "\n",
36 | "print(tens2)"
37 | ]
38 | },
39 | {
40 | "cell_type": "code",
41 | "execution_count": 17,
42 | "metadata": {},
43 | "outputs": [
44 | {
45 | "name": "stdout",
46 | "output_type": "stream",
47 | "text": [
48 | "tensor([[ 50, 56, 62, 68],\n",
49 | " [113, 128, 143, 158],\n",
50 | " [176, 200, 224, 248],\n",
51 | " [239, 272, 305, 338],\n",
52 | " [302, 344, 386, 428]], dtype=torch.int32)\n"
53 | ]
54 | }
55 | ],
56 | "source": [
57 | "ans = torch.mm(tens1, tens2)\n",
58 | "print(ans)"
59 | ]
60 | },
61 | {
62 | "cell_type": "code",
63 | "execution_count": null,
64 | "metadata": {},
65 | "outputs": [],
66 | "source": []
67 | }
68 | ],
69 | "metadata": {
70 | "kernelspec": {
71 | "display_name": "Python 3",
72 | "language": "python",
73 | "name": "python3"
74 | },
75 | "language_info": {
76 | "codemirror_mode": {
77 | "name": "ipython",
78 | "version": 3
79 | },
80 | "file_extension": ".py",
81 | "mimetype": "text/x-python",
82 | "name": "python",
83 | "nbconvert_exporter": "python",
84 | "pygments_lexer": "ipython3",
85 | "version": "3.6.8"
86 | }
87 | },
88 | "nbformat": 4,
89 | "nbformat_minor": 2
90 | }
91 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/GopikrishnanK/Day4_Task.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": 1,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "import torch\n",
10 | "import torch.nn as nn\n"
11 | ]
12 | },
13 | {
14 | "cell_type": "code",
15 | "execution_count": 8,
16 | "metadata": {},
17 | "outputs": [],
18 | "source": [
19 | "class DummyMod(nn.Module):\n",
20 | " def __init__(self,ip_size):\n",
21 | " self.ip = nn.Linear(i,64)\n",
22 | " self.h1 = nn.Linear(64,128)\n",
23 | " self.h2 = nn.Linear(128,32)\n",
24 | " self.op = nn.Linear(32,1)\n",
25 | " self.sigmo = nn.Sigmoid()\n",
26 | " \n",
27 | " def forward(x):\n",
28 | " x = self.ip(x)\n",
29 | " x = self.h1(x)\n",
30 | " x = self.sigmo(x)\n",
31 | " x = self.h2(x)\n",
32 | " x = self.op(x)\n",
33 | " return(x)\n",
34 | " \n",
35 | " "
36 | ]
37 | },
38 | {
39 | "cell_type": "code",
40 | "execution_count": 9,
41 | "metadata": {},
42 | "outputs": [
43 | {
44 | "name": "stdout",
45 | "output_type": "stream",
46 | "text": [
47 | "DummyMod(\n",
48 | " (ip): Linear(in_features=128, out_features=64, bias=True)\n",
49 | " (h1): Linear(in_features=64, out_features=128, bias=True)\n",
50 | " (h2): Linear(in_features=128, out_features=32, bias=True)\n",
51 | " (op): Linear(in_features=32, out_features=1, bias=True)\n",
52 | " (sigmo): Sigmoid()\n",
53 | ")\n"
54 | ]
55 | }
56 | ],
57 | "source": [
58 | "model = DummyMod()\n",
59 | "print(model)"
60 | ]
61 | },
62 | {
63 | "cell_type": "code",
64 | "execution_count": null,
65 | "metadata": {},
66 | "outputs": [],
67 | "source": []
68 | }
69 | ],
70 | "metadata": {
71 | "kernelspec": {
72 | "display_name": "Python 3",
73 | "language": "python",
74 | "name": "python3"
75 | },
76 | "language_info": {
77 | "codemirror_mode": {
78 | "name": "ipython",
79 | "version": 3
80 | },
81 | "file_extension": ".py",
82 | "mimetype": "text/x-python",
83 | "name": "python",
84 | "nbconvert_exporter": "python",
85 | "pygments_lexer": "ipython3",
86 | "version": "3.6.8"
87 | }
88 | },
89 | "nbformat": 4,
90 | "nbformat_minor": 2
91 | }
92 |
--------------------------------------------------------------------------------
/resources/cifar10cnn.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn as nn
3 | import torch.nn.functional as F
4 | import torchvision
5 | import torchvision.transforms as transforms
6 | import torch.optim as optim
7 |
8 | transform = transforms.Compose(
9 | [
10 | transforms.ToTensor(),
11 | transforms.Normalize(
12 | (0.5, 0.5, 0.5),
13 | (0.5, 0.5, 0.5)
14 | )
15 | ]
16 | )
17 |
18 | trainset = torchvision.datasets.CIFAR10(
19 | root='./data',
20 | train=True,
21 | download=False,
22 | transform=transform
23 | )
24 |
25 | testset = torchvision.datasets.CIFAR10(
26 | root='./data',
27 | train=False,
28 | download=False,
29 | transform=transform
30 | )
31 |
32 | trainloader = torch.utils.data.DataLoader(
33 | trainset,
34 | batch_size=4,
35 | shuffle=True,
36 | num_workers=2
37 | )
38 |
39 | testloader = torch.utils.data.DataLoader(
40 | testset,
41 | batch_size=4,
42 | shuffle=False,
43 | num_workers=2
44 | )
45 |
46 | classes = (
47 | 'plane', 'car', 'bird', 'cat',
48 | 'deer', 'dog', 'frog', 'horse', 'ship', 'truck'
49 | )
50 |
51 | class Net(nn.Module):
52 | def __init__(self):
53 | super(Net, self).__init__()
54 | self.conv1 = nn.Conv2d(3, 6, 5)
55 | self.pool = nn.MaxPool2d(2, 2)
56 | self.conv2 = nn.Conv2d(6, 16, 5)
57 | self.fc1 = nn.Linear(16 * 5 * 5, 120)
58 | self.fc2 = nn.Linear(120, 84)
59 | self.fc3 = nn.Linear(84, 10)
60 |
61 | def forward(self, x):
62 | x = self.pool(F.relu(self.conv1(x)))
63 | x = self.pool(F.relu(self.conv2(x)))
64 | x = x.view(-1, 16 * 5 * 5)
65 | x = F.relu(self.fc1(x))
66 | x = F.relu(self.fc2(x))
67 | x = self.fc3(x)
68 | return x
69 |
70 |
71 | net = Net()
72 |
73 | loss_function = nn.CrossEntropyLoss()
74 | optimizer = optim.SGD(
75 | net.parameters(),
76 | lr=0.001
77 | )
78 |
79 | for epoch in range(2):
80 | running_loss = 0.0
81 | for i, data in enumerate(trainloader, 0):
82 | # data = (inputs, labels)
83 | inputs, labels = data
84 | optimizer.zero_grad()
85 |
86 | outputs = net(inputs)
87 | loss = loss_function(outputs, labels)
88 | loss.backward()
89 | optimizer.step()
90 |
91 | running_loss = running_loss + loss.item()
92 | if i % 2000 == 1999:
93 | print(
94 | '[%d, %5d] loss: %.3f' %
95 | (epoch + 1, i+1, running_loss/2000)
96 | )
97 | running_loss = 0.0
98 | print("vola")
99 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/Jaseem ck/Task_2.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "nbformat": 4,
3 | "nbformat_minor": 0,
4 | "metadata": {
5 | "colab": {
6 | "name": "tinkerhubpytorch.ipynb",
7 | "provenance": []
8 | },
9 | "kernelspec": {
10 | "name": "python3",
11 | "display_name": "Python 3"
12 | }
13 | },
14 | "cells": [
15 | {
16 | "cell_type": "code",
17 | "metadata": {
18 | "id": "p_XfBfF72I13",
19 | "colab_type": "code",
20 | "colab": {}
21 | },
22 | "source": [
23 | "import torch.nn as nn\n",
24 | "import torch.nn.functional as F\n",
25 | "class Net(nn.Module):\n",
26 | " def __init__(self,):\n",
27 | " super(Net, self).__init__()\n",
28 | " self.fc1 = nn.Linear(256,64)\n",
29 | " self.fc2 = nn.Linear(64,32)\n",
30 | " self.fc3 = nn.Linear(32, 10)\n",
31 | " def forward(self, x):\n",
32 | " x = self.fc1(x)\n",
33 | " x = F.Sigmoid(x)\n",
34 | " x = self.fc2(x)\n",
35 | " x = F.Sigmoid(x)\n",
36 | " x = self.fc3(x)\n",
37 | " return x\n"
38 | ],
39 | "execution_count": 0,
40 | "outputs": []
41 | },
42 | {
43 | "cell_type": "code",
44 | "metadata": {
45 | "id": "oqld3eV4veTJ",
46 | "colab_type": "code",
47 | "colab": {}
48 | },
49 | "source": [
50 | "model = Net()"
51 | ],
52 | "execution_count": 0,
53 | "outputs": []
54 | },
55 | {
56 | "cell_type": "code",
57 | "metadata": {
58 | "id": "pjLG2lp2vgmS",
59 | "colab_type": "code",
60 | "colab": {
61 | "base_uri": "https://localhost:8080/",
62 | "height": 104
63 | },
64 | "outputId": "52d81444-c0a7-4e70-fc62-517e035fccb2"
65 | },
66 | "source": [
67 | "model"
68 | ],
69 | "execution_count": 42,
70 | "outputs": [
71 | {
72 | "output_type": "execute_result",
73 | "data": {
74 | "text/plain": [
75 | "Net(\n",
76 | " (fc1): Linear(in_features=256, out_features=64, bias=True)\n",
77 | " (fc2): Linear(in_features=64, out_features=32, bias=True)\n",
78 | " (fc3): Linear(in_features=32, out_features=10, bias=True)\n",
79 | ")"
80 | ]
81 | },
82 | "metadata": {
83 | "tags": []
84 | },
85 | "execution_count": 42
86 | }
87 | ]
88 | }
89 | ]
90 | }
--------------------------------------------------------------------------------
/Tasks/daily tasks/Randheerrrk/day4.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "nbformat": 4,
3 | "nbformat_minor": 0,
4 | "metadata": {
5 | "colab": {
6 | "name": "day4.ipynb",
7 | "provenance": []
8 | },
9 | "kernelspec": {
10 | "name": "python3",
11 | "display_name": "Python 3"
12 | }
13 | },
14 | "cells": [
15 | {
16 | "cell_type": "code",
17 | "metadata": {
18 | "id": "HiM8CZJPk6jc",
19 | "colab_type": "code",
20 | "colab": {}
21 | },
22 | "source": [
23 | "import torch.nn as nn\n",
24 | "import torch.nn.functional as f"
25 | ],
26 | "execution_count": 0,
27 | "outputs": []
28 | },
29 | {
30 | "cell_type": "code",
31 | "metadata": {
32 | "id": "sOedKVRUlJ9y",
33 | "colab_type": "code",
34 | "colab": {}
35 | },
36 | "source": [
37 | "class Net(nn.Module) :\n",
38 | " def __init__(self) :\n",
39 | " super(Net, self).__init__()\n",
40 | " self.i = nn.Linear(64, 32)\n",
41 | " self.h = nn.Linear(32, 16)\n",
42 | " self.o = nn.Linear(16, 10)\n",
43 | " def forward(sefl, X) :\n",
44 | " X = self.i(X)\n",
45 | " X = f.Sigmoid(X)\n",
46 | " X = self.h(X)\n",
47 | " X = f.Sigmoid(X)\n",
48 | " X = self.o(X)\n",
49 | " return X"
50 | ],
51 | "execution_count": 0,
52 | "outputs": []
53 | },
54 | {
55 | "cell_type": "code",
56 | "metadata": {
57 | "id": "pyQT3dA1m9Rp",
58 | "colab_type": "code",
59 | "colab": {
60 | "base_uri": "https://localhost:8080/",
61 | "height": 104
62 | },
63 | "outputId": "7f7381c1-a5ee-4e08-c72e-9549892569fb"
64 | },
65 | "source": [
66 | "model = Net()\n",
67 | "model"
68 | ],
69 | "execution_count": 6,
70 | "outputs": [
71 | {
72 | "output_type": "execute_result",
73 | "data": {
74 | "text/plain": [
75 | "Net(\n",
76 | " (i): Linear(in_features=64, out_features=32, bias=True)\n",
77 | " (h): Linear(in_features=32, out_features=16, bias=True)\n",
78 | " (o): Linear(in_features=16, out_features=10, bias=True)\n",
79 | ")"
80 | ]
81 | },
82 | "metadata": {
83 | "tags": []
84 | },
85 | "execution_count": 6
86 | }
87 | ]
88 | },
89 | {
90 | "cell_type": "code",
91 | "metadata": {
92 | "id": "XkvBVPvMnG_I",
93 | "colab_type": "code",
94 | "colab": {}
95 | },
96 | "source": [
97 | ""
98 | ],
99 | "execution_count": 0,
100 | "outputs": []
101 | }
102 | ]
103 | }
--------------------------------------------------------------------------------
/Tasks/daily tasks/ranjith/task2.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "nbformat": 4,
3 | "nbformat_minor": 0,
4 | "metadata": {
5 | "colab": {
6 | "name": "Welcome To Colaboratory",
7 | "provenance": [],
8 | "collapsed_sections": [],
9 | "include_colab_link": true
10 | },
11 | "kernelspec": {
12 | "display_name": "Python 3",
13 | "name": "python3"
14 | },
15 | "accelerator": "GPU"
16 | },
17 | "cells": [
18 | {
19 | "cell_type": "markdown",
20 | "metadata": {
21 | "id": "view-in-github",
22 | "colab_type": "text"
23 | },
24 | "source": [
25 | "
"
26 | ]
27 | },
28 | {
29 | "cell_type": "code",
30 | "metadata": {
31 | "id": "PkUAI5Oc7b3g",
32 | "colab_type": "code",
33 | "colab": {}
34 | },
35 | "source": [
36 | "import torch\n",
37 | "from torch import nn"
38 | ],
39 | "execution_count": 0,
40 | "outputs": []
41 | },
42 | {
43 | "cell_type": "code",
44 | "metadata": {
45 | "id": "BYcO0cQT8ASJ",
46 | "colab_type": "code",
47 | "colab": {}
48 | },
49 | "source": [
50 | "model=nn.Sequential(nn.Linear(784,128),\n",
51 | " nn.Linear(128,64),\n",
52 | " nn.Sigmoid(),\n",
53 | " nn.Linear(64,32),\n",
54 | " nn.Linear(32,10))"
55 | ],
56 | "execution_count": 0,
57 | "outputs": []
58 | },
59 | {
60 | "cell_type": "code",
61 | "metadata": {
62 | "id": "O1jf_6B1ADY2",
63 | "colab_type": "code",
64 | "colab": {
65 | "base_uri": "https://localhost:8080/",
66 | "height": 158
67 | },
68 | "outputId": "d08bb76e-f972-448e-8b91-3d8869353636"
69 | },
70 | "source": [
71 | "model"
72 | ],
73 | "execution_count": 4,
74 | "outputs": [
75 | {
76 | "output_type": "execute_result",
77 | "data": {
78 | "text/plain": [
79 | "Sequential(\n",
80 | " (0): Linear(in_features=784, out_features=128, bias=True)\n",
81 | " (1): Linear(in_features=128, out_features=64, bias=True)\n",
82 | " (2): Sigmoid()\n",
83 | " (3): Linear(in_features=64, out_features=32, bias=True)\n",
84 | " (4): Linear(in_features=32, out_features=10, bias=True)\n",
85 | ")"
86 | ]
87 | },
88 | "metadata": {
89 | "tags": []
90 | },
91 | "execution_count": 4
92 | }
93 | ]
94 | }
95 | ]
96 | }
--------------------------------------------------------------------------------
/Tasks/daily tasks/Allen K Abraham/task2.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "nbformat": 4,
3 | "nbformat_minor": 0,
4 | "metadata": {
5 | "colab": {
6 | "name": "task2.ipynb",
7 | "provenance": []
8 | },
9 | "kernelspec": {
10 | "name": "python3",
11 | "display_name": "Python 3"
12 | }
13 | },
14 | "cells": [
15 | {
16 | "cell_type": "code",
17 | "metadata": {
18 | "id": "841adttKIgfL",
19 | "colab_type": "code",
20 | "colab": {}
21 | },
22 | "source": [
23 | "import torch.nn as nn\n",
24 | "import torch"
25 | ],
26 | "execution_count": 0,
27 | "outputs": []
28 | },
29 | {
30 | "cell_type": "code",
31 | "metadata": {
32 | "id": "7KbBAQjNIvdx",
33 | "colab_type": "code",
34 | "colab": {}
35 | },
36 | "source": [
37 | "\n",
38 | "class Network(nn.Module):\n",
39 | " def __init__(self,N_in,N_out):\n",
40 | " super(Network, self).__init__()\n",
41 | " self.input = nn.Linear(N_in, 400)\n",
42 | " self.fc1 = nn.Linear(400, 100)\n",
43 | " self.fc2 = nn.Linear(100, 50)\n",
44 | " self.output = nn.Linear(50, N_out)\n",
45 | " self.sigmoid = nn.Sigmoid()\n",
46 | "\n",
47 | "\n",
48 | " def forward(self, x):\n",
49 | " \tx=self.input(x)\n",
50 | " \tx= self.fc1(x)\n",
51 | " \tx = self.sigmoid(x)\n",
52 | " \tx=self.fc2(x)\n",
53 | " \tx = self.Output(x)\n",
54 | " \treturn x"
55 | ],
56 | "execution_count": 0,
57 | "outputs": []
58 | },
59 | {
60 | "cell_type": "code",
61 | "metadata": {
62 | "id": "SE7W9rpxI-iH",
63 | "colab_type": "code",
64 | "colab": {}
65 | },
66 | "source": [
67 | "network = Network(800,25)"
68 | ],
69 | "execution_count": 0,
70 | "outputs": []
71 | },
72 | {
73 | "cell_type": "code",
74 | "metadata": {
75 | "id": "HsOAqG1dJC8N",
76 | "colab_type": "code",
77 | "colab": {
78 | "base_uri": "https://localhost:8080/",
79 | "height": 136
80 | },
81 | "outputId": "901cf8b4-38f4-4570-ca32-bf3821460af4"
82 | },
83 | "source": [
84 | "network"
85 | ],
86 | "execution_count": 4,
87 | "outputs": [
88 | {
89 | "output_type": "execute_result",
90 | "data": {
91 | "text/plain": [
92 | "Network(\n",
93 | " (input): Linear(in_features=800, out_features=400, bias=True)\n",
94 | " (fc1): Linear(in_features=400, out_features=100, bias=True)\n",
95 | " (fc2): Linear(in_features=100, out_features=50, bias=True)\n",
96 | " (output): Linear(in_features=50, out_features=25, bias=True)\n",
97 | " (sigmoid): Sigmoid()\n",
98 | ")"
99 | ]
100 | },
101 | "metadata": {
102 | "tags": []
103 | },
104 | "execution_count": 4
105 | }
106 | ]
107 | },
108 | {
109 | "cell_type": "code",
110 | "metadata": {
111 | "id": "sKGnDl15Jr75",
112 | "colab_type": "code",
113 | "colab": {}
114 | },
115 | "source": [
116 | ""
117 | ],
118 | "execution_count": 0,
119 | "outputs": []
120 | }
121 | ]
122 | }
--------------------------------------------------------------------------------
/Tasks/daily tasks/Bharath.T.U/Day2_task.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": 1,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "#importing needed packages\n",
10 | "import torch \n",
11 | "import numpy as np"
12 | ]
13 | },
14 | {
15 | "cell_type": "code",
16 | "execution_count": 2,
17 | "metadata": {},
18 | "outputs": [
19 | {
20 | "name": "stdout",
21 | "output_type": "stream",
22 | "text": [
23 | "first numpy array \"a\" with size (5, 3) is :-\n",
24 | "[[ 1.62434536 -0.61175641 -0.52817175]\n",
25 | " [-1.07296862 0.86540763 -2.3015387 ]\n",
26 | " [ 1.74481176 -0.7612069 0.3190391 ]\n",
27 | " [-0.24937038 1.46210794 -2.06014071]\n",
28 | " [-0.3224172 -0.38405435 1.13376944]]\n",
29 | "second numpy array\"b\" with size (3, 4) is :-\n",
30 | "[[-1.09989127 -0.17242821 -0.87785842 0.04221375]\n",
31 | " [ 0.58281521 -1.10061918 1.14472371 0.90159072]\n",
32 | " [ 0.50249434 0.90085595 -0.68372786 -0.12289023]]\n"
33 | ]
34 | }
35 | ],
36 | "source": [
37 | "#1st part\n",
38 | "np.random.seed(1)\n",
39 | "a=np.random.randn(5,3)\n",
40 | "b=np.random.randn(3,4)\n",
41 | "print(\"first numpy array \\\"a\\\" with size {} is :-\\n{}\".format(a.shape,a))\n",
42 | "print(\"second numpy array\\\"b\\\" with size {} is :-\\n{}\".format(b.shape,b))"
43 | ]
44 | },
45 | {
46 | "cell_type": "code",
47 | "execution_count": 3,
48 | "metadata": {},
49 | "outputs": [
50 | {
51 | "name": "stdout",
52 | "output_type": "stream",
53 | "text": [
54 | "tensor of a:-\n",
55 | "tensor([[ 1.6243, -0.6118, -0.5282],\n",
56 | " [-1.0730, 0.8654, -2.3015],\n",
57 | " [ 1.7448, -0.7612, 0.3190],\n",
58 | " [-0.2494, 1.4621, -2.0601],\n",
59 | " [-0.3224, -0.3841, 1.1338]], dtype=torch.float64)\n",
60 | "tensor of b:-\n",
61 | "tensor([[-1.0999, -0.1724, -0.8779, 0.0422],\n",
62 | " [ 0.5828, -1.1006, 1.1447, 0.9016],\n",
63 | " [ 0.5025, 0.9009, -0.6837, -0.1229]], dtype=torch.float64)\n"
64 | ]
65 | }
66 | ],
67 | "source": [
68 | "#2nd part\n",
69 | "ta=torch.from_numpy(a)\n",
70 | "tb=torch.from_numpy(b)\n",
71 | "print(\"tensor of a:-\\n{}\".format(ta))\n",
72 | "print(\"tensor of b:-\\n{}\".format(tb))"
73 | ]
74 | },
75 | {
76 | "cell_type": "code",
77 | "execution_count": 5,
78 | "metadata": {},
79 | "outputs": [
80 | {
81 | "name": "stdout",
82 | "output_type": "stream",
83 | "text": [
84 | "Dot product of ta and tb(ta.tb)\n",
85 | " tensor([[-2.4085, -0.0826, -1.7651, -0.4181],\n",
86 | " [ 0.5280, -2.8408, 3.5062, 1.0178],\n",
87 | " [-2.2024, 0.8244, -2.6212, -0.6518],\n",
88 | " [ 0.0912, -3.4221, 3.3012, 1.5609],\n",
89 | " [ 0.7005, 1.4997, -0.9318, -0.4992]], dtype=torch.float64)\n"
90 | ]
91 | }
92 | ],
93 | "source": [
94 | "#3rd part\n",
95 | "mul=torch.matmul(ta,tb)\n",
96 | "print(\"Dot product of ta and tb(ta.tb)\\n\",mul)"
97 | ]
98 | }
99 | ],
100 | "metadata": {
101 | "kernelspec": {
102 | "display_name": "Python 3",
103 | "language": "python",
104 | "name": "python3"
105 | },
106 | "language_info": {
107 | "codemirror_mode": {
108 | "name": "ipython",
109 | "version": 3
110 | },
111 | "file_extension": ".py",
112 | "mimetype": "text/x-python",
113 | "name": "python",
114 | "nbconvert_exporter": "python",
115 | "pygments_lexer": "ipython3",
116 | "version": "3.7.6"
117 | }
118 | },
119 | "nbformat": 4,
120 | "nbformat_minor": 4
121 | }
122 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/basil/task3.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "nbformat": 4,
3 | "nbformat_minor": 0,
4 | "metadata": {
5 | "colab": {
6 | "name": "task3.ipynb",
7 | "provenance": []
8 | },
9 | "kernelspec": {
10 | "name": "python3",
11 | "display_name": "Python 3"
12 | }
13 | },
14 | "cells": [
15 | {
16 | "cell_type": "code",
17 | "metadata": {
18 | "id": "cF8e7eTbCp_A",
19 | "colab_type": "code",
20 | "colab": {}
21 | },
22 | "source": [
23 | "import torch\n",
24 | "from torch import nn\n",
25 | "import torch.nn.functional as F"
26 | ],
27 | "execution_count": 0,
28 | "outputs": []
29 | },
30 | {
31 | "cell_type": "code",
32 | "metadata": {
33 | "id": "vRm9TDVhCyUO",
34 | "colab_type": "code",
35 | "colab": {}
36 | },
37 | "source": [
38 | "class neural_net(nn.Module):\n",
39 | " def __init__(self,input_shape,hid1,hid2,output_shape):\n",
40 | " super().__init__()\n",
41 | " self.layer1=nn.Linear(input_shape,hid1)\n",
42 | " self.layer2=nn.Linear(hid1,hid2)\n",
43 | " self.ouput=nn.Linear(hid2,output_shape)\n",
44 | " def forward(self,x):\n",
45 | " x=torch.sigmoid(self.layer1(x))\n",
46 | " x=torch.sigmoid(self.layer2(x))\n",
47 | " x=self.ouput(x)\n",
48 | " return x"
49 | ],
50 | "execution_count": 0,
51 | "outputs": []
52 | },
53 | {
54 | "cell_type": "code",
55 | "metadata": {
56 | "id": "G5FNnlMrFRBc",
57 | "colab_type": "code",
58 | "colab": {}
59 | },
60 | "source": [
61 | "moodel=neural_net(1024,256,256,1)"
62 | ],
63 | "execution_count": 0,
64 | "outputs": []
65 | },
66 | {
67 | "cell_type": "code",
68 | "metadata": {
69 | "id": "XRssQTOnL7-4",
70 | "colab_type": "code",
71 | "outputId": "2c28c93f-8dd7-4d39-a6c0-ae9cde831dbd",
72 | "colab": {
73 | "base_uri": "https://localhost:8080/",
74 | "height": 102
75 | }
76 | },
77 | "source": [
78 | "moodel"
79 | ],
80 | "execution_count": 4,
81 | "outputs": [
82 | {
83 | "output_type": "execute_result",
84 | "data": {
85 | "text/plain": [
86 | "neural_net(\n",
87 | " (layer1): Linear(in_features=1024, out_features=256, bias=True)\n",
88 | " (layer2): Linear(in_features=256, out_features=256, bias=True)\n",
89 | " (ouput): Linear(in_features=256, out_features=1, bias=True)\n",
90 | ")"
91 | ]
92 | },
93 | "metadata": {
94 | "tags": []
95 | },
96 | "execution_count": 4
97 | }
98 | ]
99 | },
100 | {
101 | "cell_type": "code",
102 | "metadata": {
103 | "id": "asRGX2GaHD_U",
104 | "colab_type": "code",
105 | "outputId": "13cf080a-2131-47d0-9b9c-90ec8c37f4b1",
106 | "colab": {
107 | "base_uri": "https://localhost:8080/",
108 | "height": 34
109 | }
110 | },
111 | "source": [
112 | "input=torch.randn(1,1024)\n",
113 | "moodel(input)"
114 | ],
115 | "execution_count": 6,
116 | "outputs": [
117 | {
118 | "output_type": "execute_result",
119 | "data": {
120 | "text/plain": [
121 | "tensor([[0.2871]], grad_fn=)"
122 | ]
123 | },
124 | "metadata": {
125 | "tags": []
126 | },
127 | "execution_count": 6
128 | }
129 | ]
130 | }
131 | ]
132 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ComputerVision with PyTorch Learning Program
2 |
3 | Computer Vision using PyTorch Learning Program by TinkerHub Foundation. [PyTorch](https://pytorch.org) is an open source deep learning framework created by [Facebook AI research](https://ai.facebook.com). This learning program will cover the following,
4 |
5 | * Computer vision.
6 | * Pytorch framework.
7 | * Torchvision library.
8 | * Image classification and object detection.
9 | * Transfer learning.
10 |
11 | We will be extensively using the PyTorch docs for conducting this program.
12 |
13 | ## Participants criteria
14 | * Should know object oriented programming and python.
15 | * Should know Git and GitHub.
16 | * Should know what is machine learning and some basics(different categories of ML, what is training ? What is testing ? What is dataset..etc)
17 |
18 | All the resources to get you started with the program is given in the [resources folder](https://github.com/tinkerhub-org/ComputerVision-with-PyTorch-Learning-Program/tree/master/resources). You can learn it and finish the task for joining the program!
19 |
20 | ## Join the program
21 | This learning program need you to have knowledge in following areas,
22 | 1. Python
23 | 2. GitHub
24 | 3. Basics of Machine Learning
25 |
26 | We have a coding task for selction process. You could check out the task and how to submit task [here](https://github.com/tinkerhub-org/ComputerVision-with-PyTorch-Learning-Program/tree/master/Tasks/registration_task).
27 | Watch the following video for reference.
28 |
29 | [](https://youtu.be/Y-ikkxfBwIc)
30 |
31 |
32 | ## Selection process
33 |
34 | - once the task is completed, You could fill this google form
35 |
36 | - we will update the selction status latest by 5th June.
37 |
38 | - Program starts on 6th June.
39 |
40 |
41 |
42 | ## General Program Structure
43 | Every 2 days we will share a chapter of the PyTorch docs in the morning. Participants should go through it. In the evening of the odd days we will give a task. On the following day there will be hangouts sessions with mentors.
44 |
45 |
46 |
47 | ## Program Schedule
48 | ### Day 1
49 |
50 | Google meets with the following contents:
51 |
52 | * Welcome note to TinkerHub Computer vision using PyTorch program.
53 | * Intro to PyTorch, navigate through PyTorch website.
54 | * Reading documentations. Explaining the structure of PyTorch docs.
55 | * General structure of the Program.
56 | * Prerequisites, installations, getting to know each other.
57 |
58 | ### Day 2
59 | Morning : In the telegram channel we share the following content.
60 |
61 | 1. [What is PyTorch ?](https://pytorch.org/tutorials/beginner/blitz/tensor_tutorial.html#sphx-glr-beginner-blitz-tensor-tutorial-py)
62 | 2. [Autograd: Automatic Differentiation](https://pytorch.org/tutorials/beginner/blitz/autograd_tutorial.html#sphx-glr-beginner-blitz-autograd-tutorial-py)
63 |
64 |
65 | Participants should,
66 |
67 | * Go through the docs and learn.
68 | * Try out each of the code snippets in the docs.
69 | * Note down the doubts.
70 | * Ask doubts in the github repo issues.
71 |
72 |
73 | Evening : A task will be given in the telegram channel. Participants should try to do the task, upload the code to the specified GitHub repo.
74 |
75 | ### Day 3
76 | Morning : In the telegram channel we share the following content.
77 |
78 | 1. [Neural Networks](https://pytorch.org/tutorials/beginner/blitz/neural_networks_tutorial.html#sphx-glr-beginner-blitz-neural-networks-tutorial-py)
79 | 2. [Training a Classifier](https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html#sphx-glr-beginner-blitz-cifar10-tutorial-py)
80 |
81 |
82 | Participants should,
83 |
84 | * Go through the docs and learn.
85 | * Try out each of the code snippets in the docs.
86 | * Note down the doubts.
87 | * Ask doubts in the github repo issues.
88 |
89 |
90 | Evening : A task will be given in the telegram channel. Participants should try to do the task, upload the code to the specified GitHub repo.
91 |
92 | ### Day 4
93 | Google meets sessions with the mentor in the evening.
94 |
95 | * Doubts about the last 2 days topics can be asked.
96 | * Solution of the task will be discussed.
97 |
98 |
99 | ### Day 5
100 | Morning : In the telegram channel we share the following content.
101 |
102 | 1. [What is torch.nn really ?](https://pytorch.org/tutorials/beginner/nn_tutorial.html)
103 | 2. [Visualising models, data and training with TensorBoard](https://pytorch.org/tutorials/intermediate/tensorboard_tutorial.html)
104 |
105 | Participants should,
106 |
107 | * Go through the docs and learn.
108 | * Try out each of the code snippets in the docs.
109 | * Note down the doubts.
110 | * Ask doubts in the github repo issues.
111 |
112 |
113 | Evening : A task will be given in the telegram channel. Participants should try to do the task, upload the code to the specified GitHub repo.
114 |
115 | ### Day 6
116 | Google meets session with mentor(s) in the evening,
117 |
118 | * Explain the concepts of content shared last day.
119 | * Explain the code line by line.
120 | * Clear doubts.
121 |
122 | ### Day 7
123 | Google meets session on,
124 |
125 | 1. What is computer vision ?
126 | 2. Algorithms used for computer vision?
127 | 3. TorchVision library.
128 |
129 | ### Day 8
130 | In the morning the following content will be shared in telegram.
131 |
132 |
133 | 1. [TorchVision fine tuning for computer vision tutorial](https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html)
134 | 2. [Transfer learning for computer vision tutorial](https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html)
135 |
136 |
137 | Participants should,
138 |
139 | * Go through the doc and try to understand.
140 | * Note down the doubts.
141 | * Try out the code.
142 | * Ask doubts in the github repo issues.
143 |
144 | ### Day 9
145 | Google meets sessions with the mentor in the evening.
146 |
147 | * Doubts about the last days topics can be asked.
148 | * Solution of the task will be discussed.
149 |
150 |
151 |
152 | ### Day 10
153 | Google meets session with mentor(s) on,
154 |
155 | * Choosing projects. Participants can choose transfer-learning projects or object detection projects.
156 | * Finding a dataset. Can find a dataset from kaggle..etc.
157 |
158 | ### Day 11
159 | Participants figuring out the project and dataset.
160 | Participants should,
161 |
162 | * Create a GitHub repo for the project.
163 | * Update the Readme file with the details of the project.
164 | * Find the model and dataset they are going to implement.
165 | * Fill the project form with the project repo link.
166 |
167 | ### Day 12
168 | Mentor(s) verify the project ideas. Participants make the changes.
169 |
170 | ### Day 13-14
171 | Project days.
172 |
173 | * Participants do the project.
174 | * Ask doubts to the mentors in github issues and via call.
175 | * Upload the code and trained models to the repo.
176 |
177 | ### Day 15
178 | Mentors verify the projects. Provide feedback as GitHub issues.
179 |
180 | ### Day 16
181 | Final google meets session with,
182 | * Discussion on next steps from here.
183 | * Project demos.
184 | * Certificates distribution.
185 |
186 | ## Program partner
187 |
188 | [Facebook Developer Circle Kochi](https://www.facebook.com/groups/DevCKochi/about/) is a forum for developers in Kochi, India and its surroundings who are interested in building on the Facebook platform to interact and collaborate other developers who share similar interests.
189 |
190 | ## Contributors
191 |
192 | - [GopikrishnanSasikumar](https://github.com/GopikrishnanSasikumar)
193 |
--------------------------------------------------------------------------------
/Tasks/daily tasks/ranjith/task1.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "nbformat": 4,
3 | "nbformat_minor": 0,
4 | "metadata": {
5 | "colab": {
6 | "name": "Copy of Ranjith.ipynb",
7 | "provenance": [],
8 | "collapsed_sections": [],
9 | "authorship_tag": "ABX9TyNhhN1SrmOkGeKRAbPtOxT5",
10 | "include_colab_link": true
11 | },
12 | "kernelspec": {
13 | "name": "python3",
14 | "display_name": "Python 3"
15 | }
16 | },
17 | "cells": [
18 | {
19 | "cell_type": "markdown",
20 | "metadata": {
21 | "id": "view-in-github",
22 | "colab_type": "text"
23 | },
24 | "source": [
25 | "
"
26 | ]
27 | },
28 | {
29 | "cell_type": "code",
30 | "metadata": {
31 | "id": "MKSmh4ISNpsz",
32 | "colab_type": "code",
33 | "colab": {}
34 | },
35 | "source": [
36 | "import torch\n",
37 | "import numpy as np"
38 | ],
39 | "execution_count": 0,
40 | "outputs": []
41 | },
42 | {
43 | "cell_type": "code",
44 | "metadata": {
45 | "id": "p2rMb2kPUYV5",
46 | "colab_type": "code",
47 | "outputId": "86bd996d-2708-407d-e430-0aa9566fa5ec",
48 | "colab": {
49 | "base_uri": "https://localhost:8080/",
50 | "height": 175
51 | }
52 | },
53 | "source": [
54 | "q=np.random.rand(5,3)\n",
55 | "print(q)\n",
56 | "w=np.random.rand(3,4)\n",
57 | "print(w)"
58 | ],
59 | "execution_count": 0,
60 | "outputs": [
61 | {
62 | "output_type": "stream",
63 | "text": [
64 | "[[0.65072886 0.22845178 0.37238782]\n",
65 | " [0.02598699 0.2367949 0.32273151]\n",
66 | " [0.89165286 0.87121422 0.42468716]\n",
67 | " [0.53881627 0.73737358 0.39073533]\n",
68 | " [0.0239398 0.25109741 0.79745952]]\n",
69 | "[[0.19169847 0.06496339 0.05681413 0.06623118]\n",
70 | " [0.23049396 0.48585222 0.14580906 0.70743965]\n",
71 | " [0.69193729 0.12576003 0.02682567 0.65850077]]\n"
72 | ],
73 | "name": "stdout"
74 | }
75 | ]
76 | },
77 | {
78 | "cell_type": "code",
79 | "metadata": {
80 | "id": "mImmmTrQVC_s",
81 | "colab_type": "code",
82 | "outputId": "37798ad8-caa9-4a4f-b8d2-2246879ae9b9",
83 | "colab": {
84 | "base_uri": "https://localhost:8080/",
85 | "height": 210
86 | }
87 | },
88 | "source": [
89 | "e=torch.from_numpy(q)\n",
90 | "e.mul_(0);e.add_(2)\n",
91 | "print(e)\n",
92 | "print(q)"
93 | ],
94 | "execution_count": 0,
95 | "outputs": [
96 | {
97 | "output_type": "stream",
98 | "text": [
99 | "tensor([[2., 2., 2.],\n",
100 | " [2., 2., 2.],\n",
101 | " [2., 2., 2.],\n",
102 | " [2., 2., 2.],\n",
103 | " [2., 2., 2.]], dtype=torch.float64)\n",
104 | "[[2. 2. 2.]\n",
105 | " [2. 2. 2.]\n",
106 | " [2. 2. 2.]\n",
107 | " [2. 2. 2.]\n",
108 | " [2. 2. 2.]]\n"
109 | ],
110 | "name": "stdout"
111 | }
112 | ]
113 | },
114 | {
115 | "cell_type": "code",
116 | "metadata": {
117 | "id": "GVqQuZZRV2zW",
118 | "colab_type": "code",
119 | "outputId": "0fb1bef3-8040-44f5-cf34-d10c29d0e323",
120 | "colab": {
121 | "base_uri": "https://localhost:8080/",
122 | "height": 141
123 | }
124 | },
125 | "source": [
126 | "r=torch.tensor(w)\n",
127 | "r.mul_(0);r.add_(2)\n",
128 | "print(r)\n",
129 | "print(w)"
130 | ],
131 | "execution_count": 0,
132 | "outputs": [
133 | {
134 | "output_type": "stream",
135 | "text": [
136 | "tensor([[2., 2., 2., 2.],\n",
137 | " [2., 2., 2., 2.],\n",
138 | " [2., 2., 2., 2.]], dtype=torch.float64)\n",
139 | "[[0.19169847 0.06496339 0.05681413 0.06623118]\n",
140 | " [0.23049396 0.48585222 0.14580906 0.70743965]\n",
141 | " [0.69193729 0.12576003 0.02682567 0.65850077]]\n"
142 | ],
143 | "name": "stdout"
144 | }
145 | ]
146 | },
147 | {
148 | "cell_type": "code",
149 | "metadata": {
150 | "id": "hC-8TZAJWGHE",
151 | "colab_type": "code",
152 | "outputId": "33e77434-9b11-4e70-8bfd-67decd36a1b4",
153 | "colab": {
154 | "base_uri": "https://localhost:8080/",
155 | "height": 123
156 | }
157 | },
158 | "source": [
159 | "y=np.matmul(q,r)\n",
160 | "y"
161 | ],
162 | "execution_count": 0,
163 | "outputs": [
164 | {
165 | "output_type": "execute_result",
166 | "data": {
167 | "text/plain": [
168 | "tensor([[12., 12., 12., 12.],\n",
169 | " [12., 12., 12., 12.],\n",
170 | " [12., 12., 12., 12.],\n",
171 | " [12., 12., 12., 12.],\n",
172 | " [12., 12., 12., 12.]], dtype=torch.float64)"
173 | ]
174 | },
175 | "metadata": {
176 | "tags": []
177 | },
178 | "execution_count": 118
179 | }
180 | ]
181 | },
182 | {
183 | "cell_type": "code",
184 | "metadata": {
185 | "id": "Z5jVWgfpYUzz",
186 | "colab_type": "code",
187 | "outputId": "698d2b6b-336f-473c-ab2c-e6bc42bc83ad",
188 | "colab": {
189 | "base_uri": "https://localhost:8080/",
190 | "height": 123
191 | }
192 | },
193 | "source": [
194 | "z=torch.matmul(e,r)\n",
195 | "z"
196 | ],
197 | "execution_count": 0,
198 | "outputs": [
199 | {
200 | "output_type": "execute_result",
201 | "data": {
202 | "text/plain": [
203 | "tensor([[12., 12., 12., 12.],\n",
204 | " [12., 12., 12., 12.],\n",
205 | " [12., 12., 12., 12.],\n",
206 | " [12., 12., 12., 12.],\n",
207 | " [12., 12., 12., 12.]], dtype=torch.float64)"
208 | ]
209 | },
210 | "metadata": {
211 | "tags": []
212 | },
213 | "execution_count": 125
214 | }
215 | ]
216 | },
217 | {
218 | "cell_type": "code",
219 | "metadata": {
220 | "id": "v8iknHx4bY8b",
221 | "colab_type": "code",
222 | "outputId": "59c48aaa-98ab-4916-acf8-66d9dcb10f08",
223 | "colab": {
224 | "base_uri": "https://localhost:8080/",
225 | "height": 34
226 | }
227 | },
228 | "source": [
229 | "type(r)"
230 | ],
231 | "execution_count": 0,
232 | "outputs": [
233 | {
234 | "output_type": "execute_result",
235 | "data": {
236 | "text/plain": [
237 | "torch.Tensor"
238 | ]
239 | },
240 | "metadata": {
241 | "tags": []
242 | },
243 | "execution_count": 123
244 | }
245 | ]
246 | },
247 | {
248 | "cell_type": "code",
249 | "metadata": {
250 | "id": "CkuhfCgXcN66",
251 | "colab_type": "code",
252 | "outputId": "8b01fbe3-9767-4ba4-92fe-29c9cd798159",
253 | "colab": {
254 | "base_uri": "https://localhost:8080/",
255 | "height": 34
256 | }
257 | },
258 | "source": [
259 | "type(q)"
260 | ],
261 | "execution_count": 0,
262 | "outputs": [
263 | {
264 | "output_type": "execute_result",
265 | "data": {
266 | "text/plain": [
267 | "numpy.ndarray"
268 | ]
269 | },
270 | "metadata": {
271 | "tags": []
272 | },
273 | "execution_count": 124
274 | }
275 | ]
276 | }
277 | ]
278 | }
--------------------------------------------------------------------------------