mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-12-22 14:24:22 +00:00
Move dtype size implementation to cpp file
This commit is contained in:
@@ -16,19 +16,9 @@ enum class DType
|
|||||||
// INT32, // Not implemented yet
|
// INT32, // Not implemented yet
|
||||||
};
|
};
|
||||||
|
|
||||||
size_t dtype_size(DType dtype) {
|
size_t dtype_size(DType dtype);
|
||||||
switch (dtype)
|
|
||||||
{
|
|
||||||
case DType::FLOAT32:
|
|
||||||
return 4;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw std::runtime_error("Unknown DType");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Forward declaration
|
||||||
class Backend;
|
class Backend;
|
||||||
|
|
||||||
class Tensor
|
class Tensor
|
||||||
|
|||||||
@@ -4,6 +4,19 @@
|
|||||||
|
|
||||||
using namespace CUDANet;
|
using namespace CUDANet;
|
||||||
|
|
||||||
|
size_t dtype_size(DType dtype) {
|
||||||
|
switch (dtype)
|
||||||
|
{
|
||||||
|
case DType::FLOAT32:
|
||||||
|
return 4;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw std::runtime_error("Unknown DType");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Tensor::Tensor(Shape shape, CUDANet::Backend* backend)
|
Tensor::Tensor(Shape shape, CUDANet::Backend* backend)
|
||||||
: Tensor(shape, backend->get_default_dtype(), backend) {}
|
: Tensor(shape, backend->get_default_dtype(), backend) {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user