torch固定维度切分和拼接

切分 chunk
返回的是(chunks,1,2,3)的元祖
torch.chunk(input, chunks, dim=0) → List of Tensors
参考
https://blog.csdn.net/qq_50001789/article/details/120352480?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-120352480-blog-116584065.pc_relevant_3mothn_strategy_and_data_recovery&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-120352480-blog-116584065.pc_relevant_3mothn_strategy_and_data_recovery&utm_relevant_index=2

拼接
torch.cat(tensor,维度)
https://blog.csdn.net/qq_43098167/article/details/125568600?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-125568600-blog-118085311.t0_edu_mix&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-125568600-blog-118085311.t0_edu_mix&utm_relevant_index=2

torch.stack([a,b], dim=0) 创造一个新的维度

真的 老好用了
https://blog.csdn.net/MasterCayman/article/details/109402192?spm=1001.2101.3001.6650.3&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-3-109402192-blog-120501382.t5_landing_title_tags_v3&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-3-109402192-blog-120501382.t5_landing_title_tags_v3&utm_relevant_index=4

你可能感兴趣的:(python基础,pytorch,深度学习,人工智能)