• 2024-06-12解决报错 cuDNN error: CUDNN_STATUS_NOT_SUPPORTED. This error may appear if you passed in a non-contiguou
      训练模型出现报错cuDNNerror: CUDNN_STATUS_NOT_SUPPORTED.Thiserrormayappearifyoupassedinanon-contiguousinput.1.尝试了对可能的tensor添加.contiguous()函数,不能解决问题,排除。2.尝试将batch_size=12减小到10,不再报错,但实验要求不能减小batch_s
  • 2024-04-22Python pytorch 坐标系变换与维度转换
    前言深度学习中经常要用到张量坐标系变换与维度转换,因此记录一下,避免混淆坐标系变换坐标系变换(矩阵转置),主要是调换tensor/array的维度pytorchimporttorchdefinfo(tensor):print(f"tensor:{tensor}")print(f"tensorsize:{tensor.size()}")print(f"tenso
  • 2023-07-26nn.MaxPool2d()、transpose().contiguous()、view()说明
    1.nn.MaxPool2d()和nn.Conv2D()基本一样,但是stride默认值是kernel_size。2.transpose().contiguous()、view()contiguous一般与transpose,permute,view搭配使用:使用transpose或permute进行维度变换后,调用contiguous,然后方可使用view对维度进行变形print(x.shape)x=x.transpos
  • 2023-06-05Pytorch中张量的连续性:contiguous
    根据PyTorch文档¹,t.contiguous()返回一个包含与t张量相同数据的连续张量。如果t张量已经是连续的,这个函数返回t张量本身。一个张量是连续的,如果张量中的相邻元素在内存中实际上是相邻的³。有些对张量的操作,例如transpose(),permute(),view()和narrow(),不改变张量的内容,但改变数
  • 2023-02-02[LeetCode]Maximum Subarray
    QuestionFindthecontiguoussubarraywithinanarray(containingatleastonenumber)whichhasthelargestsum.Forexample,giventhearray[-2,1,-3,4,-1,2,1
  • 2022-12-02Pytorch tensor操作 gather、expand、repeat、reshape、view、permute、transpose
    文章目录​​tensor.gather​​​​tensor.expand​​​​tensor.repeat​​​​reshape()和view()​​​​permute()和transpose()​​​​torch.matmul()​​​​torc
  • 2022-11-08leetcode-1784-easy
    CheckifBinaryStringHasatMostOneSegmentofOnesGivenabinarystringswithoutleadingzeros,returntrueifscontainsatmostonecontiguoussegment
  • 2022-10-05torch.nn.RNNBase.flatten_parameters()
    Resetsparameterdatapointersothattheycanusefastercodepaths. Rightnow,thisworksonlyifthemoduleisontheGPUandcuDNNisenabled.Otherwise
  • 2022-10-01[Oracle] LeetCode 53 Maximum Subarray 贪心
    Givenanintegerarraynums,findthecontiguoussubarray(containingatleastonenumber)whichhasthelargestsumandreturnitssum.Asubarrayisacontig