This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import OrderedDict | |
from pathlib import Path | |
lines = Path('README.md').read_text().split('\n') | |
for line in lines: | |
if line.startswith('###'): | |
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ignite.engines import Events, Engine | |
from enum import Enum | |
from ignite._utils import _to_hours_mins_secs | |
class CostumEvents(Enum): | |
EPOCH_STARTED = "epoch_started" | |
EPOCH_COMPLETED = "epoch_completed" | |
STARTED = "started" | |
COMPLETED = "completed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
from torch.autograd import Variable | |
import collections | |
class Dummy(nn.Module): | |
def forward(self, x): return x | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from importlib import reload, import_module | |
from os import stat | |
class auto_import(object): | |
""" | |
auto_import(mod, pkg = None, brute = False, verbose=False) : | |
Description: | |
Import a module and reimport it every time it changes. | |
Useful in a REPL, when debugging some functions from a file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8<------------------------ graphs.c ------------------------ | |
#include <stdlib.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
typedef unsigned char u8; | |
typedef unsigned short u16; | |
typedef unsigned int u32; | |
typedef char s8; | |
struct byte { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdarg.h> | |
#include "generic-json-zero-copy.h" | |
void print_xjson(char *prefix, char *postfix, xjson *b, offset off, int len) | |
{ | |
int i; | |
printf("len=%d,off=%d ",len, off); | |
printf("%s", prefix); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#define stringify(s) #s | |
#define genb_printf(var, cast) printf( "| %d:%6s: %3d to %3d\n", __LINE__,stringify(cast), var,(cast) var); | |
#define do_print(i, from, to, cast ) for( i = from; i < to; i++) { genb_printf(i, cast); } | |
#define assert(var, cast, res) (((cast)var) == (res)) |