1
00:00:00,050 --> 00:00:03,980
In this section we'll look at how TensorFlow deals with strings.

2
00:00:03,980 --> 00:00:11,450
So TensorFlow has this um TF strings module and which contains this different methods which you can

3
00:00:11,450 --> 00:00:12,230
see right here.

4
00:00:12,230 --> 00:00:16,280
And the way a TensorFlow string can be created is very easy.

5
00:00:16,280 --> 00:00:20,810
So all we have is just the same syntax.

6
00:00:20,810 --> 00:00:25,880
Let's say here we have TensorFlow tensor string TensorFlow constant.

7
00:00:26,270 --> 00:00:27,860
So it's the same syntax.

8
00:00:27,860 --> 00:00:38,300
And then in here if we have a 1D um tensor of strings you just have to say I am um and then uh and then

9
00:00:38,300 --> 00:00:38,780
string.

10
00:00:38,780 --> 00:00:39,740
So there we go.

11
00:00:39,740 --> 00:00:41,450
We have I am a string.

12
00:00:41,690 --> 00:00:45,320
We have tensor string.

13
00:00:46,010 --> 00:00:53,690
And you see now that we have this tensor um, which is of type string, um, and it's a 1D tensor.

14
00:00:53,690 --> 00:00:55,310
So we have a shape three.

15
00:00:55,310 --> 00:01:00,230
Then here we have the actual um values in our string.

16
00:01:00,230 --> 00:01:04,400
So we have I am uh and then string.

17
00:01:04,400 --> 00:01:07,220
Then we have different methods which we could um, use.

18
00:01:07,220 --> 00:01:09,110
So let's, let's take for example join.

19
00:01:09,110 --> 00:01:14,630
It performs element wise concatenation of list of uh of a list of string tensors.

20
00:01:14,630 --> 00:01:17,600
So we just need to specify the separator.

21
00:01:17,600 --> 00:01:18,830
And that's fine.

22
00:01:18,830 --> 00:01:21,470
So we have um tensor string.

23
00:01:21,470 --> 00:01:24,200
And then we have this list.

24
00:01:24,200 --> 00:01:28,010
And you see how it generates the output which is now concatenated.

25
00:01:28,010 --> 00:01:29,990
So let's let's test this out.

26
00:01:29,990 --> 00:01:36,560
Let's say we have um let's let's get back and check out the signal or the the syntax again.

27
00:01:36,560 --> 00:01:39,650
So TensorFlow strings join is fine.

28
00:01:39,920 --> 00:01:44,120
We have TensorFlow strings join.

29
00:01:44,120 --> 00:01:47,390
We have tensor tensor string.

30
00:01:48,080 --> 00:01:53,330
And then we have the separator uh which we could put set to plus.

31
00:01:53,330 --> 00:01:55,460
So let's run that and see what we get.

32
00:01:55,460 --> 00:02:00,410
See I am a string now separated with a plus.

33
00:02:00,410 --> 00:02:04,850
Now let's say we have tensor string one and tensor string two.

34
00:02:04,850 --> 00:02:17,300
So let's just copy this and repeat that and say I am I am um let's say not a string.

35
00:02:17,810 --> 00:02:19,520
So that's two.

36
00:02:19,550 --> 00:02:22,220
Here we have one and then we have two.

37
00:02:22,310 --> 00:02:26,210
And then here we put this um in this list.

38
00:02:26,210 --> 00:02:33,410
So we have tensor string one and tensor tensor string two.

39
00:02:33,710 --> 00:02:34,610
There we go.

40
00:02:34,610 --> 00:02:40,370
So run that and you see how we have this I am concatenated with I am.

41
00:02:40,370 --> 00:02:43,130
So you have I am concatenated with I am.

42
00:02:43,130 --> 00:02:48,470
And then we have a concatenated with not a a plus not a.

43
00:02:48,470 --> 00:02:52,580
And then we have string concatenated with string still the same output shape.

44
00:02:52,580 --> 00:02:54,710
We have many other methods.

45
00:02:54,830 --> 00:02:57,980
Um, you have the length obviously that gives you the length of the string.

46
00:02:57,980 --> 00:03:01,310
You have a string byte, split format and so on and so forth.

47
00:03:01,310 --> 00:03:05,330
So you could feel free to check, um, all this out nonetheless.

48
00:03:05,330 --> 00:03:11,420
Um, in this course, uh, wherever we'll need to use any of, of these methods, we shall explain them

49
00:03:11,420 --> 00:03:15,530
so that you understand exactly what we're doing.

50
00:03:15,710 --> 00:03:21,950
You could see here, for example, that this F string can convert your input, which initially was an

51
00:03:21,950 --> 00:03:25,250
int um, into a string type.

52
00:03:25,250 --> 00:03:27,680
So feel free to check out our other methods.

53
00:03:27,680 --> 00:03:30,710
We're going to move on now to TensorFlow variables.
