You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

ConcatLink.py 720 B

5 years ago
1234567891011121314151617181920
  1. from __future__ import absolute_import
  2. import ctypes
  3. from .._base import _LIB
  4. from .. import ndarray as _nd
  5. def concat(in_arr1, in_arr2, out_arr, axis=0, stream=None):
  6. assert isinstance(in_arr1, _nd.NDArray)
  7. assert isinstance(in_arr2, _nd.NDArray)
  8. assert isinstance(out_arr, _nd.NDArray)
  9. _LIB.DLGpuConcat(in_arr1.handle, in_arr2.handle,
  10. out_arr.handle, axis, stream.handle if stream else None)
  11. def concat_gradient(out_grad_arr, in_arr, axis=0, idx=0, stream=None):
  12. assert isinstance(out_grad_arr, _nd.NDArray)
  13. assert isinstance(in_arr, _nd.NDArray)
  14. _LIB.DLGpuConcat_gradient(
  15. out_grad_arr.handle, in_arr.handle, axis, idx, stream.handle if stream else None)