Skip to content

Instantly share code, notes, and snippets.

View Pythonista7's full-sized avatar
🕴️
Debugging Intensely

Ashwin Pythonista7

🕴️
Debugging Intensely
View GitHub Profile
def linear_regression(x):
return W * x + b
def mean_square(y_pred,y_true):
return tf.reduce_mean(tf.square(y_pred-y_true))
optimizers = tf.optimizers.SGD(learning_rate=0.01)
def run_optimization():
with tf.GradientTape() as g:
def model(X):
ŷ = processing(X)
return ŷ
def doML(X,y):
while(!ModeIsGood):
predicted = model(X)
error = minimize(predicted - y)
if( almostEquals(predicted , y) ):
ModeIsGood = true
>>> tf.reduce_mean([a, b, c])
<tf.Tensor: shape=(), dtype=int32, numpy=3>
>>> tf.reduce_sum([a, b, c])
<tf.Tensor: shape=(), dtype=int32, numpy=10>
>>> matrix1 = tf.constant([[1., 2.], [3., 4.]])
>>> matrix2 = tf.constant([[5., 6.], [7., 8.]])
>>> tf.matmul(matrix1, matrix2)
<tf.Tensor: shape=(2, 2), dtype=float32,
>>> import tensorflow as tf
>>> a = tf.constant(2)
>>> a
<tf.Tensor: shape=(), dtype=int32, numpy=2>
>>> b = tf.constant(3)
>>> c = tf.constant(5)
>>>
>>> tf.add(a, b)
<tf.Tensor: shape=(), dtype=int32, numpy=5>
>>> tf.subtract(a, b)
rank_0_tensor = tf.constant(4)
print(rank_0_tensor)
tf.Tensor(4, shape=(), dtype=int32)
rank_1_tensor = tf.constant([2.0, 3.0, 4.0])
print(rank_1_tensor)
rank_2_tensor = tf.constant([[1, 2],
[3, 4],
[5, 6]], dtype=tf.float16)
Originall From: Posted 2015-05-29 http://ubwg.net/b/full-list-of-ffmpeg-flags-and-options
This is the complete list that’s outputted by ffmpeg when running ffmpeg -h full.
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…
Getting help:
-h — print basic options
-h long — print more options
-h full — print all options (including all format and codec specific options, very long)
@Pythonista7
Pythonista7 / foss-event-gcc-gdb.md
Last active June 30, 2021 10:49
foss-event-gcc/gdb Instructions

Install info

Installation of BASH, GCC, GDB on Debian/Ubuntu

Run the following

$ sudo apt install gcc gdb build-essential codeblocks

Installation of BASH, GCC, GDB on Windows

@Pythonista7
Pythonista7 / tfjs-Day3.html
Last active June 21, 2021 12:57
tfjs-Day3
<html>
<script
src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@latest">
</script>
<script lang="js">
async function readCSV() {
const csvUrl = 'iris.csv';
const trainingData = tf.data.csv(csvUrl, {
columnConfigs: {
species: {
@Pythonista7
Pythonista7 / Dockerfile
Created June 14, 2021 07:47
Dockerfile for ffmpeg4.4
FROM node:14.15.4-slim
WORKDIR /app
# Ensures tzinfo doesn't ask for region info.
ENV DEBIAN_FRONTEND noninteractivesdsd
RUN apt-get update && apt-get install -y wget \
xz-utils \
dumb-init \
import tensorflow as tf
# Loading the data
mnist = tf.keras.datasets.mnist
(x_train,y_train),(x_test,y_test) =
mnist.load_data()
# Preprocessing - Normalization
x_train, x_test = x_train / 255.0, x_test / 255.0
# Build the network