See this for demo
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
/** | |
* Flattens an input tensor. | |
* @param inputs Tensor input | |
*/ | |
function flatten(inputs: Tensor) { | |
return g.reshape(inputs, (() => { | |
let i = 1; | |
inputs.shape.forEach((val) => { i *= val }); | |
return [i]; |
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
// 32 5x5 filters | |
var network = conv2d(tensor, 32, 5, graph); | |
// 32 5x5 filters, stride 2, "same" padding with relu activation | |
var network = conv2d(tensor, 32, 5, graph, 2, "SAME", undefined, (layer, graph) => {return graph.relu(layer)}); | |
// applying some kernel_initializer | |
var network = conv2d(x, 32, 5, g, undefined, undefined, undefined, undefined, new RandomUniformInitializer(0, 0.5)); |
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
function conv2d( | |
inputs: Tensor, | |
filters: number, | |
kernel_size: number, | |
graph: Graph, | |
strides: number = 1, | |
padding = "valid", | |
data_format = "channels_last", | |
activation?, | |
kernel_initializer: Initializer = new VarianceScalingInitializer(), |
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
function conv2d( | |
inputs: Tensor, | |
filters: number, | |
kernel_size: number, | |
graph: Graph, | |
strides: number = 1, | |
padding = "valid", | |
data_format = "channels_last", | |
activation?, | |
kernel_initializer: Initializer = new VarianceScalingInitializer(), |
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 {Array1D, NDArray, NDArrayMathGPU, Scalar, Graph, InCPUMemoryShuffledInputProviderBuilder, Session, FeedEntry, AdamOptimizer, Initializer, ZerosInitializer, VarianceScalingInitializer, CostReduction} from 'deeplearn'; | |
import { Tensor } from 'deeplearn/dist/src/graph/graph'; | |
const learning_rate = 0.001 | |
const num_steps = 2000 | |
const batch_size = 128 | |
const num_classes = 10 // MNIST total classes (0-9 digits) | |
const num_input = 784 // MNIST data input (img shape: 28*28) |
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
#!/usr/bin/env python2 | |
# -*- coding: utf-8 -*- | |
import os | |
import subprocess | |
import sys | |
import re | |
import random | |
MAX_SEGMENTS=100 |
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
mount -o remount,rw /system /system | |
cd /system/bin | |
wget https://gist.githubusercontent.com/alseambusher/dbe72dac05b17c28cc13/raw/c23e9e42c506ceb18177f5d3db7a20ca0874f624/python | |
chmod +x python |
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
#!/bin/bash | |
# remove fuse4x and install ntfs-3g and osxfuse | |
brew remove fuse4x | |
brew install ntfs-3g | |
brew install osxfuse | |
# replace the old one | |
sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.old | |
sudo ln -s /usr/local/Cellar/ntfs-3g/*/sbin/mount_ntfs /sbin/mount_ntfs |
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
#!/bin/bash | |
open -a "`ls -d /Applications/*.app|grep -i $1`" $2 $3 $4 $5 $6 |
NewerOlder