Skip to content

Instantly share code, notes, and snippets.

@jayendra13
jayendra13 / datasets.py
Created January 10, 2022 15:24
Merging Two datasets
import tensorflow as tf
def approach_1():
def gen():
l = ["foo", "bar", "baz"]
l1 = [f"{x}_py" for x in l]
l2 = [f"{x}_java" for x in l]
d1 = tf.data.Dataset.from_tensor_slices(l1)
import gin
import jax
import jax.numpy as jnp
import haiku as hk
@gin.configurable
class Model(hk.Module):
def __init__(self, num_classes, name=None):
super().__init__(name=name)
import mmap
from cffi import FFI
"""
add.c
double add(double a, double b) {
return a+b
}
~$ gcc -O3 -c add.c
~$ objdump -d add.o
import math
import numpy as np
def original_mirror(x, direction=0, reverse=False):
"""Mirrors left to right or top to bottom as per the direction."""
x_ = np.copy(x)
height, width = x.shape
if direction == 0:
half_break = math.ceil(height/2)
shift = height % 2
import t5
import tensorflow.compat.v1 as tf
tpu = tf.distribute.cluster_resolver.TPUClusterResolver("node-1")
tpu_address = tpu.get_master()
tf.disable_v2_behavior()
def data_gen(split, shuffle_files=False):
ds = tf.data.Dataset.from_tensor_slices(["foobar"]).repeat(100)
# Replace String to int at line 33
:33 s/String/int/
# Replace String to int from line 33 to 40
:33,40 s/String/int/
# To query which package contains my file if installed
dpkg-query -S ASTConsumer.h
libclang-6.0-dev: /usr/lib/llvm-6.0/include/clang/AST/ASTConsumer.h
# if not installed search here
https://packages.ubuntu.com/
# More general case
# https://www.ostechnix.com/find-package-provides-specific-file-linux/
# Arch Linux, Antergos, Manjaro Linux
from zmq.eventloop import ioloop
ioloop.install()
from zmq.eventloop.ioloop import ZMQIOLoop
from zmq.eventloop.zmqstream import ZMQStream
from functools import partial
from jupyter_client import MultiKernelManager
from tornado import gen
from tornado.concurrent import Future
from pprint import pprint
//working gulpfile.js for yeoman
//from https://github.com/yeoman/generator-angular/issues/1299
// Generated on 2016-03-15 using generator-angular 0.15.1
'use strict';
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var openURL = require('open');
var lazypipe = require('lazypipe');
var rimraf = require('rimraf');
from zmq.eventloop import ioloop
ioloop.install()
from zmq.eventloop.ioloop import ZMQIOLoop
from zmq.eventloop.zmqstream import ZMQStream
from functools import partial
from jupyter_client import MultiKernelManager
from tornado import gen
from tornado.concurrent import Future
from pprint import pprint