answering own question:

  
      github.com
  
  
    e-lab/pytorch-toolbox/blob/master/linear2conv/spatial_model.ipynb 3
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Take in a model with linear layer which say works for image of resolution 3x224x224\n",
    "# Convert it into a spatial model which can now work on any image size\n",
    "\n",
    "import torch\n",
    "import torch.nn as nn\n",
    "import torchvision.models as models\n",
    "from torch.autograd import Variable"
   ]
  },
  {


  This file has been truncated. show original