zoukankan      html  css  js  c++  java
  • transforms.functional.to_tensor 的作用

    import torchvision.transforms as transforms
    
    image = transforms.functional.to_tensor(image)

    Convert a PIL Image or numpy.ndarray to tensor. This function does not support torchscript.

    https://pytorch.org/vision/stable/transforms.html#torchvision.transforms.functional.to_tensor

    Convert a PIL Image or numpy.ndarray to tensor. This transform does not support torchscript.

    Converts a PIL Image or numpy.ndarray (H x W x C) in the range [0, 255] to a torch.FloatTensor of shape (C x H x W) in the range [0.0, 1.0] if the PIL Image belongs to one of the modes (L, LA, P, I, F, RGB, YCbCr, RGBA, CMYK, 1) or if the numpy.ndarray has dtype = np.uint8

    In the other cases, tensors are returned without scaling.

    https://pytorch.org/vision/stable/_modules/torchvision/transforms/transforms.html#ToTensor

  • 相关阅读:
    排序
    最小栈
    移除链表元素
    回文链表
    maven自动建立目录骨架
    maven的结构和构建命令
    递归
    链表的中间结点
    括号匹配
    软件工程个人作业01
  • 原文地址:https://www.cnblogs.com/mrlonely2018/p/14953281.html
Copyright © 2011-2022 走看看