C:\Users\15522\PycharmProjects\PythonProject\.venv\Scripts\python.exe C:\Users\15522\PycharmProjects\PythonProject\文本张量tensorboard可视化\1.py
2025-11-03 16:56:29.063876: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2025-11-03 16:56:34.863479: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
Building prefix dict from the default dictionary ...
Loading model from cache C:\Users\15522\AppData\Local\Temp\jieba.cache
jieba分词结果: [['时光', '流转', ',', '愿', '你', '与', '珍视', '之', '人', '再度', '重逢'], ['所谓', '觉悟', ',', '就是', '能', '在', '黑暗', '的', '荒野', '中', ',', '开辟', '出', '一条', '应当', '前进', '的', '道路']]
mytokenizer.word_index {',': 1, '的': 2, '时光': 3, '流转': 4, '愿': 5, '你': 6, '与': 7, '珍视': 8, '之': 9, '人': 10, '再度': 11, '重逢': 12, '所谓': 13, '觉悟': 14, '就是': 15, '能': 16, '在': 17, '黑暗': 18, '荒野': 19, '中': 20, '开辟': 21, '出': 22, '一条': 23, '应当': 24, '前进': 25, '道路': 26}
mytokenizer.index_word {1: ',', 2: '的', 3: '时光', 4: '流转', 5: '愿', 6: '你', 7: '与', 8: '珍视', 9: '之', 10: '人', 11: '再度', 12: '重逢', 13: '所谓', 14: '觉悟', 15: '就是', 16: '能', 17: '在', 18: '黑暗', 19: '荒野', 20: '中', 21: '开辟', 22: '出', 23: '一条', 24: '应当', 25: '前进', 26: '道路'}
my_token_list dict_values([',', '的', '时光', '流转', '愿', '你', '与', '珍视', '之', '人', '再度', '重逢', '所谓', '觉悟', '就是', '能', '在', '黑暗', '荒野', '中', '开辟', '出', '一条', '应当', '前进', '道路'])
[[3, 4, 1, 5, 6, 7, 8, 9, 10, 11, 12], [13, 14, 1, 15, 16, 17, 18, 2, 19, 20, 1, 21, 22, 23, 24, 25, 2, 26]]
Loading model cost 0.494 seconds.
Prefix dict has been built successfully.
词嵌入层embed Embedding(26, 8)
词嵌入层的矩阵 tensor([[ 0.2307, 1.5899, -0.5819, -0.9151, 1.0146,
-0.1126, -0.6835, 1.9709],
[ 2.0407, 0.7600, -1.2509, -0.3563, 0.1356,
-0.0021, 0.2522, -1.0539],
[ 0.9124, -0.0723, 1.7848, 0.5889, 1.8855,
-0.1431, 0.5497, 0.1055],
[ -0.1318, -0.8340, 1.2602, -1.1459, 0.5092,
1.7017, 0.4397, -1.0814],
[ -0.4125, -0.3676, -1.1163, -2.2388, -0.8329,
1.0278, 0.5321, 0.0081],
[ 0.2288, -1.1784, -1.0550, -0.5459, -0.7667,
-0.0334, -0.7720, -1.2713],
[ 1.3941, -1.3963, 0.4875, -0.1831, -0.8079,
-0.6201, 0.3474, 0.0757],
[ 0.2530, 1.5645, -1.5902, 0.3084, 0.5192,
0.7282, 0.3455, 0.1198],
[ -0.9330, 0.2880, 0.1390, -1.2108, -0.9997,
1.9848, 1.2998, 0.6283],
[ -0.6334, 0.4963, -0.1726, 0.8671, -0.9366,
-0.9752, -0.1679, -1.2855],
[ -0.5111, -1.1550, -1.1553, -0.7965, 0.1624,
0.3075, 0.9903, -1.0316],
[ 0.6070, 0.3321, 1.1337, -0.0173, 1.1234,
0.6473, -0.0677, -0.8709],
[ 0.0970, 2.0479, 0.0321, -0.5874, -0.5075,
-1.5318, 0.7667, 0.6393],
[ 0.8273, 1.1637, 0.2775, -1.2212, 0.1898,
0.0198, -0.2331, 1.2161],
[ 0.7576, -0.4817, -0.5832, 0.1853, 1.2443,
0.9732, -0.3485, 1.0217],
[ -2.0022, 1.1760, -0.6108, -0.4936, -0.2207,
1.0378, -0.1762, 1.5720],
[ -1.4428, 1.2423, -0.7145, -2.4560, 0.3858,
-0.3647, -0.8257, 0.6859],
[ 0.7440, -1.0135, 1.5522, -0.5507, 0.5932,
-0.1015, 2.6558, -0.3379],
[ 0.9263, 1.2357, -0.5167, 2.7073, -0.7024,
1.6512, 1.8944, -1.1542],
[ 1.1959, -0.4262, -0.1611, 0.4163, -1.6393,
-1.5403, 1.2635, -1.2384],
[ -0.3669, -1.2192, 0.4763, 2.5318, 1.1097,
-1.2486, -0.3900, 0.8039],
[ -0.5775, 0.3513, 1.0952, 2.6775, 0.8120,
-1.3369, 0.2662, -1.1366],
[ 0.0638, -0.3984, 0.6102, -0.2126, -0.0010,
-0.1697, -0.4525, 0.4812],
[ 0.5282, 0.2357, -0.2698, -0.6239, 0.8822,
-1.1423, 0.8384, 1.1340],
[ -1.3024, 1.1859, -0.4800, 0.5965, 0.5318,
1.3479, 0.2936, 0.0782],
[ -0.9062, -1.3692, 1.9555, 0.5612, 0.4775,
1.1571, -0.7171, -0.0709]])
torch.Size([26, 8])
<class 'torch.Tensor'>
Traceback (most recent call last):
File "C:\Users\15522\PycharmProjects\PythonProject\文本张量tensorboard可视化\1.py", line 46, in <module>
nnembeding_show()
File "C:\Users\15522\PycharmProjects\PythonProject\文本张量tensorboard可视化\1.py", line 33, in nnembeding_show
summarywriter = SummaryWriter()
File "C:\Users\15522\PycharmProjects\PythonProject\.venv\lib\site-packages\torch\utils\tensorboard\writer.py", line 250, in __init__
self._get_file_writer()
File "C:\Users\15522\PycharmProjects\PythonProject\.venv\lib\site-packages\torch\utils\tensorboard\writer.py", line 265, in _get_file_writer
self.file_writer = FileWriter(
File "C:\Users\15522\PycharmProjects\PythonProject\.venv\lib\site-packages\torch\utils\tensorboard\writer.py", line 76, in __init__
self.event_writer = EventFileWriter(
File "C:\Users\15522\PycharmProjects\PythonProject\.venv\lib\site-packages\tensorboard\summary\writer\event_file_writer.py", line 72, in __init__
tf.io.gfile.makedirs(logdir)
File "C:\Users\15522\PycharmProjects\PythonProject\.venv\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 513, in recursive_create_dir_v2
_pywrap_file_io.RecursivelyCreateDir(compat.path_to_bytes(path))
tensorflow.python.framework.errors_impl.FailedPreconditionError: runs is not a directory
进程已结束,退出代码为 1
最新发布