PyTorch
殇情雨
Stay hungry Stay foolish
展开
-
【无标题】
最容易理解的torch.gather()b = torch.Tensor([[1,2,3],[4,5,6]])... print(b)... index_1 = torch.LongTensor([[0,1,2],[0,1,2]])... index_2 = torch.LongTensor([[0,0,0],[1,1,1]])... print (torch.gather(b, dim=1, index=index_1))... print (torch.gather(b, dim=0, in原创 2022-05-08 01:12:44 · 92 阅读 · 0 评论 -
深度学习中flatten的进一步理解
下图是keras关于flatten的描述在深度学习中,flatten对batch size没有影响那在深度学习中,flatten函数的输入常常是多维的,里面的数据是按照什么方式展开的呢?下面举例说明对于(1,3,4,2)的数据,其中1代表着 batch sizeinputarray([[[[ 1, 2], [ 3, 4], [ 5, 6], [ 7, 8]], [[ 9, 10], [11, 12]原创 2022-03-30 16:22:56 · 1657 阅读 · 0 评论 -
深度学习 pytorch tensorflow debug合集
记录在使用pytorch,tensorflow过程中遇到的问题在服务器上加载数据时报错: ValueError: cannot reshape array of size 826818560 into shape (90000,18,256,2)代码中没有reshape的操作却出现了这种问题,原因是在上传数据时数据传输有问题,解决办法是重新传数据(注意,如果第一次传很慢,重传很快就传完了说明系统缓存了第一次传的数据,因此需要用特别的办法比如给数据改名字重传)...原创 2022-03-22 23:00:55 · 1717 阅读 · 0 评论