Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

import tensorflow as tf

tensor_zero_d = tf.constant(4)
print(tensor_zero_d)

tensorflow_one_d = tf.constant([1,0,-4,0,66],dtype=tf.float32)
print(tensorflow_one_d)

casted_tensor_one_d = tf.cast(tensorflow_one_d,dtype=tf.bool)
print(casted_tensor_one_d)

tensor_two_d = tf.constant([[1,2,3],
[4,5,6],
[7,8,9]])
print(tensor_two_d)

tensor_three_d = tf.constant([

[ [1,2,3],
[4,5,6]],

[[11,22,33],
[44,55,66]],

[[111,222,333],
[444,555,666]],
])
print(tensor_three_d)
print(tensor_zero_d.shape)
print(tensorflow_one_d.shape)
print(tensor_three_d.shape)

tensor_four_d = tf.constant([
[
[ [1,2,3],
[4,5,6]],

[[1,22,33],
[4,55,6]],

[[11,22,33],
[44,55,666]],
],
[
[ [1,42,3],
[4,5,6]],

[[1,2,33],
[4,5,6]],

[[11,22,3],
[44,55,6]],
],

[
[ [1,2,3],
[4,5,6]],

[[1,2,3],
[4,5,6]],

[[1,22,3],
[4,5,6]],
],
])
print(tensor_four_d)

You might also like