Skip to content

Instantly share code, notes, and snippets.

View bicepjai's full-sized avatar

Jayaram Prabhu Durairaj bicepjai

View GitHub Profile
@danijar
danijar / blog_tensorflow_scope_decorator.py
Last active January 17, 2023 01:58
TensorFlow Scope Decorator
# Working example for my blog post at:
# https://danijar.github.io/structuring-your-tensorflow-models
import functools
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
def doublewrap(function):
"""
A decorator decorator, allowing to use the decorator to be used without
import tensorflow as tf
import numpy as np
if __name__ == '__main__':
np.random.seed(1)
# the size of the hidden state for the lstm (notice the lstm uses 2x of this amount so actually lstm will have state of size 2)
size = 1
# 2 different sequences total
batch_size= 2
# the maximum steps for both sequences is 10
@vladignatyev
vladignatyev / progress.py
Last active March 31, 2024 22:54
Python command line progress bar in less than 10 lines of code.
# The MIT License (MIT)
# Copyright (c) 2016 Vladimir Ignatev
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the Software
# is furnished to do so, subject to the following conditions:
#
@mejibyte
mejibyte / gist:1268157
Created October 6, 2011 18:15
Implementation of Ukkonen's algorithm to build a prefix tree in O(n)
using namespace std;
#include <algorithm>
#include <iostream>
#include <iterator>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>