change(tensor): move ts.AtDevice from c_generated to tensor.go

This commit is contained in:
sugarme 2020-07-21 16:23:44 +10:00
parent 579abdb750
commit 959a1c8a99
2 changed files with 6 additions and 6 deletions

View File

@ -25,12 +25,6 @@ func AtgTo(ptr *Ctensor, self Ctensor, device int) {
C.atg_to(ptr, self, cdevice)
}
// int at_device(tensor);
func AtDevice(ts Ctensor) int {
cint := C.at_device(ts)
return *(*int)(unsafe.Pointer(&cint))
}
// void atg_grad(tensor *, tensor self);
func AtgGrad(ptr *Ctensor, self Ctensor) {
C.atg_grad(ptr, self)

View File

@ -40,6 +40,12 @@ func NewTensor() Ctensor {
return C.at_new_tensor()
}
// int at_device(tensor);
func AtDevice(ts Ctensor) int {
cint := C.at_device(ts)
return *(*int)(unsafe.Pointer(&cint))
}
// tensor at_tensor_of_data(void *vs, int64_t *dims, size_t ndims, size_t element_size_in_bytes, int type);
func AtTensorOfData(vs unsafe.Pointer, dims []int64, ndims uint, elt_size_in_bytes uint, kind int) Ctensor {