Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Data Science by (17.6k points)

I tried to get the output of following code, instead of output I get the dimension of variable.

I have gone through google search but I got nothing related to it.

a=np.array([1,2,3])

b=np.array([4,5,6])

c=np.array([7,8,9])

a = keras.backend.variable(a)

b = keras.backend.variable(b)

c = keras.backend.variable(c)

merged_vector = concatenate([a,b,c], axis=-1)

print(merged_vector)

Here is the output I get instead of value stored in "merged_vector."

"Tensor("concatenate_2/concat:0", shape=(9,), dtype=float32)"

1 Answer

0 votes
by (17.6k points)

Using get_value:

import numpy as np

import keras

from keras.layers import concatenate

import tensorflow as tf

a=np.array([1,2,3])

b=np.array([4,5,6])

c=np.array([7,8,9])

a = keras.backend.variable(a)

b = keras.backend.variable(b)

c = keras.backend.variable(c)

merged_vector = concatenate([a,b,c], axis=-1)

print(keras.backend.get_value(merged_vector))

Browse Categories

...