示例#1
0
def ascontiguousarray(a):
    if not a.transposed:
        return a
    out = cudarray.empty_like(a)
    n, m = a.shape
    array_ops._transpose(a._data, m, n, out._data)
    return out
示例#2
0
def ascontiguousarray(a):
    if not a.transposed:
        return a
    out = cudarray.empty_like(a)
    n, m = a.shape
    array_ops._transpose(a._data, m, n, out._data)
    return out
示例#3
0
 def batches(self):
     x1 = ca.empty(self.x_shape, dtype=self.x.dtype)
     x2 = ca.empty_like(x1)
     for start, stop in self._batch_slices():
         if stop > start:
             x1_np = self.x[start:stop]
             x2_np = self.x2[start:stop]
         else:
             x1_np = np.concatenate((self.x[start:], self.x[:stop]))
             x2_np = np.concatenate((self.x[start:], self.x[:stop]))
         ca.copyto(x1, x1_np)
         ca.copyto(x2, x2_np)
         yield x1, x2
示例#4
0
文件: feed.py 项目: EricSchles/deeppy
 def batches(self):
     x1 = ca.empty(self.x_shape, dtype=self.x.dtype)
     x2 = ca.empty_like(x1)
     for start, stop in self._batch_slices():
         if stop > start:
             x1_np = self.x[start:stop]
             x2_np = self.x2[start:stop]
         else:
             x1_np = np.concatenate((self.x[start:], self.x[:stop]))
             x2_np = np.concatenate((self.x[start:], self.x[:stop]))
         ca.copyto(x1, x1_np)
         ca.copyto(x2, x2_np)
         yield x1, x2
示例#5
0
 def batches(self):
     x1 = ca.empty(self.x_shape, dtype=self.x.dtype)
     x2 = ca.empty_like(x1)
     y = ca.empty(self.y_shape, dtype=self.y.dtype)
     for start, stop in self._batch_slices():
         if stop > start:
             x1_np = self.x[start:stop]
             x2_np = self.x2[start:stop]
             y_np = self.y[start:stop]
         else:
             x1_np = np.concatenate((self.x[start:], self.x[:stop]))
             x2_np = np.concatenate((self.x[start:], self.x[:stop]))
             y_np = np.concatenate((self.y[start:], self.y[:stop]))
         ca.copyto(x1, x1_np)
         ca.copyto(x2, x2_np)
         ca.copyto(y, y_np)
         yield {'x1': x1, 'x2': x2, 'y': y}
示例#6
0
文件: input.py 项目: EddyChndr/deeppy
 def batches(self):
     x1 = ca.empty(self.x_shape, dtype=self.x.dtype)
     x2 = ca.empty_like(x1)
     y = ca.empty(self.y_shape, dtype=self.y.dtype)
     for start, stop in self._batch_slices():
         if stop > start:
             x1_np = self.x[start:stop]
             x2_np = self.x2[start:stop]
             y_np = self.y[start:stop]
         else:
             x1_np = np.concatenate((self.x[start:], self.x[:stop]))
             x2_np = np.concatenate((self.x[start:], self.x[:stop]))
             y_np = np.concatenate((self.y[start:], self.y[:stop]))
         ca.copyto(x1, x1_np)
         ca.copyto(x2, x2_np)
         ca.copyto(y, y_np)
         yield {'x1': x1, 'x2': x2, 'y': y}
示例#7
0
 def grad_array(self):
     ''' Returns the gradient array. '''
     if self._grad is None:
         self._grad = ca.empty_like(self.array)
     return self._grad
示例#8
0
 def grad_array(self):
     ''' Returns the gradient array. '''
     if self._tmp_grad_array is None:
         self._tmp_grad_array = ca.empty_like(self.array)
     return self._tmp_grad_array