将x_train转化为Numpy数组
时间: 2024-04-30 16:17:25 浏览: 90
MNIST数据集转化为二维图片的实现示例
好的,以下是将x_train转化为Numpy数组的代码示例:
```python
import numpy as np
x_train = ["I like cats", "She loves dogs", "We prefer birds"]
x_train_numpy = np.array(x_train)
print(x_train_numpy)
```
执行上述代码后,会输出以下结果:
```
['I like cats' 'She loves dogs' 'We prefer birds']
```
这样就成功将x_train转化为Numpy数组了。
阅读全文