I have a function that returns me a variable called layer - images in the format:
<tf.Tensor 'Conv2D_1:0' shape=(?, 16, 16, 1) dtype=float32>
I need to save these image in .jpeg.
So far I've thought of doing this:
# Reshape into tf.image.encode...

Asked By whoisraibolt

I have been using the introductory example of matrix multiplication in TensorFlow.
matrix1 = tf.constant([[3., 3.]])
matrix2 = tf.constant([[2.],[2.]])
product = tf.matmul(matrix1, matrix2)
When I print the product, it is displaying it as a Tensor obje...

Asked By Dawny33

I have been using the introductory example of matrix multiplication in TensorFlow.
matrix1 = tf.constant([[3., 3.]])
matrix2 = tf.constant([[2.],[2.]])
product = tf.matmul(matrix1, matrix2)
When I print the product, it is displaying it as a Tensor obje...

Asked By Dawny33

In Tensorflow, I can initialize variables in two the ways:
Call global_variable_intializer before declaration of variable:
import tensorflow as tf
# Initialize the global variable and session
init = tf.global_variables_initializer()
sess = tf.Session(...

Asked By Pankit Gami

I am learning tensorflow, I picked up the following code from the tensorflow website. According to my understanding, axis=0 is for rows and axis=1 is for columns.
How are they getting output mentioned in comments? I have mentioned output according to my ...

Asked By Bhaskar Dhariyal

I am learning tensorflow, I picked up the following code from the tensorflow website. According to my understanding, axis=0 is for rows and axis=1 is for columns.
How are they getting output mentioned in comments? I have mentioned output according to my ...

Asked By Bhaskar Dhariyal

I'm building a small neural net in Keras meant for a regression task, and I want to use the same accuracy metric as the scikit-learn RandomForestRegressor:
The coefficient R^2 is defined as (1 - u/v), where u is the regression sum of squares ((y_true...

Asked By Nick

I have successfully obtained the confusion matrix of (7x7). It is in tensor form.
I want to view the confusion matrix. Tried .eval and sess method but it doesnt work.
my code:
n_classes = 7
prediction = neural_network(x)
correct = tf.equal(tf.argmax...

Asked By E.Goh

So assuming I have this:
TensorShape([Dimension(None), Dimension(32)])
And I use tf.split on this tensor _X with the dimension above:
_X = tf.split(_X, 128, 0)
What is the shape of this new tensor? The output is a list so its hard to know the sh...

Asked By Chaine

Hi I am new to tensorflow. I want to implement the following python code in tensorflow.
import numpy as np
a = np.array([1,2,3,4,5,6,7,9,0])
print(a) ## [1 2 3 4 5 6 7 9 0]
print(a.shape) ## (9,)
b = a[:, np.newaxis] ### want to write this in tensorflow....

Asked By Rahul

I am new to TensorFlow. While I am reading the existing documentation, I found the term tensor really confusing. Because of it, I need to clarify the following questions:
What is the relationship between tensor and Variable, tensor
vs. tf.constant, 'ten...

Asked By ZijunLost

I am new to TensorFlow. While I am reading the existing documentation, I found the term tensor really confusing. Because of it, I need to clarify the following questions:
What is the relationship between tensor and Variable, tensor
vs. tf.constant, 'ten...

Asked By ZijunLost

I define a tensor like this:
x = tf.get_variable("x", [100])
But when I try to print shape of tensor :
print( tf.shape(x) )
I get Tensor("Shape:0", shape=(1,), dtype=int32), why the result of output should not be shape=(100)

Asked By Nils Cao

I define a tensor like this:
x = tf.get_variable("x", [100])
But when I try to print shape of tensor :
print( tf.shape(x) )
I get Tensor("Shape:0", shape=(1,), dtype=int32), why the result of output should not be shape=(100)

Asked By Nils Cao

I am trying an Op that is not behaving as expected.
graph = tf.Graph()
with graph.as_default():
train_dataset = tf.placeholder(tf.int32, shape=[128, 2])
embeddings = tf.Variable(
tf.random_uniform([50000, 64], -1.0, 1.0))
embed = tf.nn.embeddin...

Asked By Thoran

I am trying an Op that is not behaving as expected.
graph = tf.Graph()
with graph.as_default():
train_dataset = tf.placeholder(tf.int32, shape=[128, 2])
embeddings = tf.Variable(
tf.random_uniform([50000, 64], -1.0, 1.0))
embed = tf.nn.embeddin...

Asked By Thoran

My question is in two connected parts:
How do I calculate the max along a certain axis of a tensor? For example, if I have
x = tf.constant([[1,220,55],[4,3,-1]])
I want something like
x_max = tf.max(x, axis=1)
print sess.run(x_max)
output: [220,4]...

Asked By aphdstudent

My question is in two connected parts:
How do I calculate the max along a certain axis of a tensor? For example, if I have
x = tf.constant([[1,220,55],[4,3,-1]])
I want something like
x_max = tf.max(x, axis=1)
print sess.run(x_max)
output: [220,4]...

Asked By aphdstudent

What would be the most efficient way to multiply (element-wise) a 2D tensor (matrix):
x11 x12 .. x1N
...
xM1 xM2 .. xMN
by a vertical vector:
w1
...
wN
to obtain a new matrix:
x11*w1 x12*w2 ... x1N*wN
...
xM1*w1 xM2*w2 ... xMN*wN
To give some con...

Asked By Andrzej Pronobis

What would be the most efficient way to multiply (element-wise) a 2D tensor (matrix):
x11 x12 .. x1N
...
xM1 xM2 .. xMN
by a vertical vector:
w1
...
wN
to obtain a new matrix:
x11*w1 x12*w2 ... x1N*wN
...
xM1*w1 xM2*w2 ... xMN*wN
To give some con...

Asked By Andrzej Pronobis