From a1084cac495a4762e4c646f4989bc02d62e729e0 Mon Sep 17 00:00:00 2001 From: Allen K Abraham Date: Sat, 13 Jun 2020 15:41:03 +0530 Subject: [PATCH] Task 2 --- Tasks/daily tasks/Allen K Abraham/task2.ipynb | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 Tasks/daily tasks/Allen K Abraham/task2.ipynb diff --git a/Tasks/daily tasks/Allen K Abraham/task2.ipynb b/Tasks/daily tasks/Allen K Abraham/task2.ipynb new file mode 100644 index 0000000..9157f15 --- /dev/null +++ b/Tasks/daily tasks/Allen K Abraham/task2.ipynb @@ -0,0 +1,122 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "task2.ipynb", + "provenance": [] + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + } + }, + "cells": [ + { + "cell_type": "code", + "metadata": { + "id": "841adttKIgfL", + "colab_type": "code", + "colab": {} + }, + "source": [ + "import torch.nn as nn\n", + "import torch" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "7KbBAQjNIvdx", + "colab_type": "code", + "colab": {} + }, + "source": [ + "\n", + "class Network(nn.Module):\n", + " def __init__(self,N_in,N_out):\n", + " super(Network, self).__init__()\n", + " self.input = nn.Linear(N_in, 400)\n", + " self.fc1 = nn.Linear(400, 100)\n", + " self.fc2 = nn.Linear(100, 50)\n", + " self.output = nn.Linear(50, N_out)\n", + " self.sigmoid = nn.Sigmoid()\n", + "\n", + "\n", + " def forward(self, x):\n", + " \tx=self.input(x)\n", + " \tx= self.fc1(x)\n", + " \tx = self.sigmoid(x)\n", + " \tx=self.fc2(x)\n", + " \tx = self.Output(x)\n", + " \treturn x" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "SE7W9rpxI-iH", + "colab_type": "code", + "colab": {} + }, + "source": [ + "network = Network(800,25)" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "HsOAqG1dJC8N", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 136 + }, + "outputId": "901cf8b4-38f4-4570-ca32-bf3821460af4" + }, + "source": [ + "network" + ], + "execution_count": 4, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Network(\n", + " (input): Linear(in_features=800, out_features=400, bias=True)\n", + " (fc1): Linear(in_features=400, out_features=100, bias=True)\n", + " (fc2): Linear(in_features=100, out_features=50, bias=True)\n", + " (output): Linear(in_features=50, out_features=25, bias=True)\n", + " (sigmoid): Sigmoid()\n", + ")" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 4 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "sKGnDl15Jr75", + "colab_type": "code", + "colab": {} + }, + "source": [ + "" + ], + "execution_count": 0, + "outputs": [] + } + ] +} \ No newline at end of file