no. Python doesn’t have JITting.
However, you can use Cython, cython code is as concise and nice, and also has indexing and stuff.
For now, in your cython code, you can convert the Tensor to .numpy() and use cython to modify the Tensor.
Here’s an example of using cython to modify numpy arrays:

  
      github.com
  
  
    rbgirshick/py-faster-rcnn/blob/master/lib/nms/cpu_nms.pyx 173
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------

import numpy as np
cimport numpy as np

cdef inline np.float32_t max(np.float32_t a, np.float32_t b):
    return a if a >= b else b

cdef inline np.float32_t min(np.float32_t a, np.float32_t b):
    return a if a <= b else b

def cpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float thresh):
    cdef np.ndarray[np.float32_t, ndim=1] x1 = dets[:, 0]
    cdef np.ndarray[np.float32_t, ndim=1] y1 = dets[:, 1]
    cdef np.ndarray[np.float32_t, ndim=1] x2 = dets[:, 2]


  This file has been truncated. show original