Skip to content

Instantly share code, notes, and snippets.

Utkarsh Chauhan chauhan-utk

Block or report user

Report or block chauhan-utk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chauhan-utk
chauhan-utk / file.md
Created Mar 10, 2018
PyTorch replace pretrained model layers
View file.md

This code snippet shows how we can change a layer in a pretrained model. In the following code, we change all the ReLU activation functions with SELU in a resnet18 model.

import torch
from torchvision import model

resnet18 = model.resnet18(pretrained=True)

def funct(list_mods):
@chauhan-utk
chauhan-utk / GitHub_basics.md
Created Feb 16, 2018
Basic setting up for GitHub
View GitHub_basics.md

Changing the GitHub repo url in local from HTTPS to git

see this link. Basic commands are as follows:

  • git remote -v
  • git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
  • git remote -v
View Gradients_hooks.md

How to modify the gradients in the backward pass? Using a register_hook for saving the gradients of a Variable: link When we want to get more crazy with the gradients and want only one gradient computation to be done from two heads

    zz1
   /   
yy
   \
     zz2
@chauhan-utk
chauhan-utk / Basics.md
Last active May 3, 2019
Git and GitHub basic commands
View Basics.md

Basic git commands:

  • git fetch : get remote commits to local repo
  • git pull <repo> <branch-name> e.g. git pull origin master : get the commits from remote branch to current branch
  • git branch -a : list all branches including remote branches
    • git checkout <branch-name> : switch to the branch
  • git branch -m <new-name> : rename current local branch. Check this for more information.
  • git checkout -b <new-branch> : create a new branch based on the current branch
    • git checkout -b <new-branch> <existing-branch> : create a new branch given an existing branch
  • git status : list of files tracked and not tracked
  • git add . or git add <file-names> : add files to staging area
You can’t perform that action at this time.