August 2019
Intermediate to advanced
202 pages
5h 9m
English
Ragged Tensors can be used in a manner similar to regular tensors in many cases. TensorFlow provides over 100 operators that support Ragged Tensors. These operators can be broadly classified as fundamental mathematical operators, array operators, or string operators, among others.
The following code block shows the process of adding two Ragged Tensors:
x = tf.ragged.constant([ [1, 2, 3, 4], [1, 2] ])y = tf.ragged.constant([ [4, 3, 2, 1], [5, 6] ])print(tf.add(x, y))
This results in the following output:
<tf.RaggedTensor [[5, 5, 5, 5], [6, 8]]>
Another interesting feature is that operator overloading is defined for Ragged Tensors. This means that a programmer can intuitively use operators such as +, -, *, ...
Read now
Unlock full access