Skip to content

Instantly share code, notes, and snippets.

View rorybyrne's full-sized avatar

Rory Byrne rorybyrne

View GitHub Profile
@rorybyrne
rorybyrne / hierarchical_modular_mask.py
Last active August 30, 2022 09:37
Algorithm to recursively generate a hierarchical modular connectivity mask using PyTorch
"""A function to generate a modular connectivity mask.
You can use it to mask a weight matrix, and then mask the gradients using a hook to fully disable those connections.
self.hh = Parameter(torch.normal(...))
mask = hierarchical_modular_mask(200, level=3, density=0.05, scale=2.0)
self.hh.data *= mask
self.hh.register_hook(lambda grad: grad * mask)
"""
@rorybyrne
rorybyrne / sample.xml
Created April 17, 2021 07:35
LaTeXML output of a sample LaTeX document (https://guides.nyu.edu/LaTeX/sample-document)
<?xml version="1.0" encoding="UTF-8"?>
<?latexml searchpaths="/home/rory/projects/personal/notpaper/docs,/home/rory/projects/personal/notpaper"?>
<!-- %This is a simple sample document. For more complicated documents take a look in the excersice tab. Note that everything that comes after a % symbol is treated as comment and ignored when the code is compiled. --><?latexml class="article"?>
<?latexml package="amsmath"?>
<!-- %Sets article title --><!-- %Sets authors name --><!-- %Sets date for date compiled --><!-- %The preamble ends with the command “begin–document˝ --><?latexml RelaxNGSchema="LaTeXML"?>
<document xmlns="http://dlmf.nist.gov/LaTeXML" class="ltx_authors_1line">
<resource src="LaTeXML.css" type="text/css"/>
<resource src="ltx-article.css" type="text/css"/>
<title>Simple Sample</title>
<creator role="author">

Keybase proof

I hereby claim:

  • I am synek on github.
  • I am rorytbyrne (https://keybase.io/rorytbyrne) on keybase.
  • I have a public key ASBWDdK9KD1aeMiueUaxH2IeEm5MHkvp05AOHmkwKRgCAwo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am roryofbyrne on github.
  • I am rorytbyrne (https://keybase.io/rorytbyrne) on keybase.
  • I have a public key ASBWDdK9KD1aeMiueUaxH2IeEm5MHkvp05AOHmkwKRgCAwo

To claim this, I am signing this object:

@rorybyrne
rorybyrne / xstyled-emotion.d.ts
Last active March 22, 2020 10:07
Type definitions for @xstyled/emotion
declare module '@xstyled/emotion' {
import styled_, { StyledComponent } from '@emotion/styled'
export * from '@emotion/core'
/// Theme Type ///
type Theme = object; // Default theme {}
// ** Uncomment to use your custom theme **
// import customTheme from 'path/to/your/theme'