Numpy
masterleoo
这个作者很懒,什么都没留下…
展开
-
tensor和ndarray的相互转换,同时需要注意cuda和cpu的迁移
【代码】tensor和ndarray的相互转换,同时需要注意cuda和cpu的迁移。原创 2023-11-08 16:55:51 · 541 阅读 · 0 评论 -
使用new_zeros和zeros_like分别返回与输入相同尺寸/类型/device的tensor和ndarray
3)device:返回tensor的期望device,默认与输入tensor具有相同的torch.device。2)dtype:返回tensor的期望类型,默认与输入tensor具有相同的torch.dtype。1)size: list或者tuple,定义输出tensor的尺寸。dtype:输出数组的期望类型,默认与a相同。shape:输出数组的期望尺寸,默认与a相同。原创 2023-11-06 11:09:08 · 1033 阅读 · 0 评论 -
【numpy】np.where() + np.unique()的使用
【代码】【numpy】np.where() + np.unique()的使用。原创 2023-06-02 15:47:54 · 127 阅读 · 0 评论