mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-12-23 06:44:24 +00:00
Migrate model class to Tensor
This commit is contained in:
@@ -1,11 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <format>
|
||||
#include <vector>
|
||||
|
||||
namespace CUDANet {
|
||||
|
||||
typedef std::vector<size_t> Shape;
|
||||
|
||||
std::string format_shape(const Shape& shape) {
|
||||
std::string result;
|
||||
for (size_t i = 0; i < shape.size(); ++i) {
|
||||
if (i > 0) result += ", ";
|
||||
result += std::to_string(shape[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
class InvalidShapeException : public std::runtime_error {
|
||||
public:
|
||||
InvalidShapeException(
|
||||
@@ -35,16 +45,6 @@ class InvalidShapeException : public std::runtime_error {
|
||||
format_shape(shape_b)
|
||||
)
|
||||
) {}
|
||||
|
||||
private:
|
||||
static std::string format_shape(const Shape& shape) {
|
||||
std::string result;
|
||||
for (size_t i = 0; i < shape.size(); ++i) {
|
||||
if (i > 0) result += ", ";
|
||||
result += std::to_string(shape[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace CUDANet
|
||||
|
||||
Reference in New Issue
Block a user