mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-12-23 23:04:25 +00:00
Refactor Tensor methods to use void* for data handling and add device_ptr method
This commit is contained in:
@@ -92,6 +92,18 @@ size_t Tensor::size() const {
|
||||
return total_size;
|
||||
}
|
||||
|
||||
void* Tensor::device_ptr() {
|
||||
return d_ptr;
|
||||
}
|
||||
|
||||
void Tensor::zero() {
|
||||
backend->zero(*this);
|
||||
}
|
||||
|
||||
void Tensor::fill(int value) {
|
||||
backend->fill(*this, value);
|
||||
}
|
||||
|
||||
void Tensor::set_data(void *data) {
|
||||
backend->copy_to_device(*this, data, total_size);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user