Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify the order of params and add ASSERT_EQ #5

Open
wants to merge 1 commit into
base: second
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/data/tensor.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//
//
// Created by fss on 22-12-16.
//

Expand All @@ -25,7 +25,7 @@ class Tensor<float> {
public:
explicit Tensor() = default;

explicit Tensor(uint32_t channels, uint32_t rows, uint32_t cols);
explicit Tensor(uint32_t rows, uint32_t cols, uint32_t channels);

Tensor(const Tensor &tensor);

Expand Down
2 changes: 1 addition & 1 deletion source/data/tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace kuiper_infer {

Tensor<float>::Tensor(uint32_t channels, uint32_t rows, uint32_t cols) {
Tensor<float>::Tensor(uint32_t rows, uint32_t cols, uint32_t channels) {
data_ = arma::fcube(rows, cols, channels);
}

Expand Down
3 changes: 3 additions & 0 deletions test/test_tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
TEST(test_tensor, create) {
using namespace kuiper_infer;
Tensor<float> tensor(3, 32, 32);
ASSERT_EQ(tensor.empty(), false);
ASSERT_EQ(tensor.channels(), 3);
ASSERT_EQ(tensor.rows(), 32);
ASSERT_EQ(tensor.cols(), 32);
Expand All @@ -18,6 +19,7 @@ TEST(test_tensor, create) {
TEST(test_tensor, fill) {
using namespace kuiper_infer;
Tensor<float> tensor(3, 3, 3);
ASSERT_EQ(tensor.empty(), false);
ASSERT_EQ(tensor.channels(), 3);
ASSERT_EQ(tensor.rows(), 3);
ASSERT_EQ(tensor.cols(), 3);
Expand All @@ -44,6 +46,7 @@ TEST(test_tensor, fill) {
TEST(test_tensor, padding1) {
using namespace kuiper_infer;
Tensor<float> tensor(3, 3, 3);
ASSERT_EQ(tensor.empty(), false);
ASSERT_EQ(tensor.channels(), 3);
ASSERT_EQ(tensor.rows(), 3);
ASSERT_EQ(tensor.cols(), 3);
Expand Down