Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _make_tensor_descriptor_array(xs, length):
"""Make an array of pointers denoting pointers of tensor descriptors.
"""
descs = []
batch_size = xs.shape[0] // length
for i in range(length):
x = xs[i*batch_size:(i+1)*batch_size]
if x.ndim < 3:
shape = x.shape + (1,) * (3 - x.ndim)
x = x.reshape(shape)
desc = cudnn.create_tensor_nd_descriptor(x)
descs.append(desc)
return PointerArray([d.value for d in descs], descs)