You might be interested in this gist, which uses a CUDA memcpy via PyCUDA to go the other direction. Presumably you could use the same technique to go from a texture to PyTorch.

  
      gist.github.com
  
  
    https://gist.github.com/victor-shepardson/5b3d3087dc2b4817b9bffdb8e87a57c4 149
pytorch-glumpy.py
from contextlib import contextmanager
import numpy as np
import torch
from torch import Tensor, ByteTensor
import torch.nn.functional as F
from torch.autograd import Variable
import pycuda.driver
from pycuda.gl import graphics_map_flags
from glumpy import app, gloo, gl

This file has been truncated. show original