Computer Science, asked by rilemka32001, 10 months ago

From the data described in the above question, what will be the dimensions of the following tensor:


Y = X[20:, 10:25, :5, :100, :50]

(5, 15, 5, 5, 50)

(20, 15, 5, 100, 50)

(30, 15, 5, 5, 50)

Error

Answers

Answered by BrainlyAkriti02
0

Tensorflow's name is directly derived from its core framework: Tensor. In Tensorflow, all the computations involve tensors. A tensor is a vector or matrix of n-dimensions that represents all types of data. All values in a tensor hold identical data type with a known (or partially known) shape. The shape of the data is the dimensionality of the matrix or array.

A tensor can be originated from the input data or the result of a computation. In TensorFlow, all the operations are conducted inside a graph. The graph is a set of computation that takes place successively. Each operation is called an op node and are connected to each other.

The graph outlines the ops and connections between the nodes. However, it does not display the values. The edge of the nodes is the tensor, i.e., a way to populate the operation with data.

Output

Tensor("ones_3:0", shape=(3, 2), dtype=float32)

Type of data

The second property of a tensor is the type of data. A tensor can only have one type of data at a time. A tensor can only have one type of data. You can return the type with the property dtype.

print(m_shape.dtype)

Output

<dtype: 'int32'>

In some occasions, you want to change the type of data. In TensorFlow, it is possible with tf.cast method.

Example

Below, a float tensor is converted to integer using you use the method cast.

# Change type of data

type_float = tf.constant(3.123456789, tf.float32)

type_int = tf.cast(type_float, dtype=tf.int32)

print(type_float.dtype)

print(type_int.dtype)

Output

<dtype: 'float32'>

<dtype: 'int32'>

TensorFlow chooses the type of data automatically when the argument is not specified during the creation of the tensor. TensorFlow will guess what is the most likely types of data. For instance, if you pass a text, it will guess it is a string and convert it to string.

Creating operator

Some Useful TensorFlow operators

You know how to create a tensor with TensorFlow. It is time to learn how to perform mathematical operations.

Similar questions