Add-Method
title: "Add Method"
author: "Raja CSP Raman"
date: 2019-05-07
description: "-"
type: technical_note
draft: false
import tensorflow as tf
import os
# Just disables the warning, doesn't enable AVX/FMA
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
<tf.Tensor 'Add_2:0' shape=() dtype=int32>
# assign the new value to a
update = tf.assign(a, c)
<tf.Variable 'Variable_4:0' shape=() dtype=int32_ref>
# You can't change the constant by using assign.
# Initialize global variables
init_op = tf.global_variables_initializer()
session = tf.Session()
session.run(init_op)
for _ in range(4):
session.run(update)
print(session.run(a))
Score: 15
Census-Data
title: "Census Data and Linear Classifier"
author: "Raja CSP Raman"
date: 2019-05-07
description: "-"
type: technical_note
draft: false
import tensorflow as tf
import os
# Just disables the warning, doesn't enable AVX/FMA
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import numpy as np
import pandas as pd
census = pd.read_csv("/Users/rajacsp/datasets …
Read More
Eager Execution In Tensorflow
title: "Eager Execution in Tensorflow"
author: "Raja CSP Raman"
date: 2019-05-07
description: "-"
type: technical_note
draft: false
import tensorflow as tf
import os
# Just disables the warning, doesn't enable AVX/FMA
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
tf.enable_eager_execution()
a = tf.constant([1.0, 2.0])
<tf.Tensor: id=3, shape …
Read More
Feed Dictionary
title: "Feed Dictionary"
author: "Raja CSP Raman"
date: 2019-05-07
description: "-"
type: technical_note
draft: false
import tensorflow as tf
import os
# Just disables the warning, doesn't enable AVX/FMA
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
a = tf.placeholder(tf.float32)
b = tf.placeholder(tf.float32)
c = tf.multiply(a, b)
with tf …
Read More
Fetching-Variable-State
title: "Template"
author: "Raja CSP Raman"
date: 2019-05-07
description: "-"
type: technical_note
draft: false
import tensorflow as tf
import os
# Just disables the warning, doesn't enable AVX/FMA
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
a = tf.constant(2)
b = tf.constant(3)
c = tf.add(a, b)
d = tf.multiply(a, b …
Read More
Graph
title: "Graph"
author: "Raja CSP Raman"
date: 2019-05-07
description: "-"
type: technical_note
draft: false
import tensorflow as tf
import os
# Just disables the warning, doesn't enable AVX/FMA
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
graph = tf.get_default_graph()
a = tf.constant(2, name = "one")
operations = graph.get_operations()
operations
Read More
Intialize-Variables
title: "Initialize Variables"
author: "Raja CSP Raman"
date: 2019-05-07
description: "-"
type: technical_note
draft: false
import tensorflow as tf
import os
# Just disables the warning, doesn't enable AVX/FMA
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
init_op = tf.global_variables_initializer()
# initialize variables
session.run(init_op)
Score: 5
Read More
Name Scope
title: "Name Scope"
author: "Raja CSP Raman"
date: 2019-05-07
description: "-"
type: technical_note
draft: false
import tensorflow as tf
import os
# Just disables the warning, doesn't enable AVX/FMA
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
# to clear the graph before new nodes
tf.reset_default_graph()
with tf.name_scope("march"):
a = tf.constant(1 …
Read More
Numpy-2-Tensor
title: "Numpy 2 Tensor"
author: "Raja CSP Raman"
date: 2019-05-07
description: "-"
type: technical_note
draft: false
import tensorflow as tf
import numpy as np
import os
# Just disables the warning, doesn't enable AVX/FMA
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
a = np.zeros((3, 3))
ta = tf.convert_to_tensor(a)
with tf.Session …
Read More
Numpy Multiplication In Tensorflow
title: "Numpy Multplication in Tensorflow"
author: "Raja CSP Raman"
date: 2019-05-07
description: "-"
type: technical_note
draft: false
import tensorflow as tf
import os
# Just disables the warning, doesn't enable AVX/FMA
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
matrix1 = tf.constant([[3., 3.0]])
matrix2 = tf.constant([[2.0],[2.0]])
product = tf …
Read More