torch.meshgrid(*tensors, **kwargs)函数的使用举例

参考链接: torch.meshgrid(*tensors, **kwargs)
torch.meshgrid(*tensors, **kwargs)函数的使用举例
代码实验举例:

Python 3.7.4 (default, Aug  9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> x = torch.tensor([1, 2, 3])
>>> y = torch.tensor([4, 5, 6, 7, 8])
>>> x
tensor([1, 2, 3])
>>> y
tensor([4, 5, 6, 7, 8])
>>> grid_x, grid_y = torch.meshgrid(x, y)
>>> grid_x
tensor([[1, 1, 1, 1, 1],
        [2, 2, 2, 2, 2],
        [3, 3, 3, 3, 3]])
>>> grid_y
tensor([[4, 5, 6, 7, 8],
        [4, 5, 6, 7, 8],
        [4, 5, 6, 7, 8]])
>>>
>>>
>>>   
上一篇:修改元素自带的属性


下一篇:《精品毕设》java ssm springboot网上蛋糕商城项目完整源码+论文