Skip to content

Instantly share code, notes, and snippets.


Adam Paszke apaszke

View GitHub Profile
View hack.cpp
// Compile with:
// g++ -c -fpic -o hack.o hack.cpp && g++ -shared -o hack.o
// Then load with the Python
// import ctypes; ctypes.CDLL('')
#include <stdio.h>
#include <dlfcn.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/mman.h>
View ncdu-model-explore
json = require 'cjson'
function buildNcduLayer(name, module)
local result = nil
if torch.isTensor(module) then
if module:numel() ~= 0 then
local strt = {name..': [' .. torch.typename(module) .. ' of size '}
for i=1,module:nDimension() do
table.insert(strt, module:size(i))
if i ~= module:nDimension() then