Internal MediaPipe Tasks change
PiperOrigin-RevId: 540083633
This commit is contained in:
committed by
Copybara-Service
parent
6cf7148f3b
commit
b97d11fa76
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "mediapipe/framework/port/gmock.h"
|
||||
#include "mediapipe/framework/port/gtest.h"
|
||||
@@ -34,6 +35,17 @@ TEST(General, TestDataTypes) {
|
||||
EXPECT_EQ(t_bool.bytes(), t_bool.shape().num_elements() * sizeof(bool));
|
||||
}
|
||||
|
||||
TEST(General, TestDynamic) {
|
||||
Tensor t1(Tensor::ElementType::kFloat32, Tensor::Shape({1, 2, 3, 4}, true));
|
||||
EXPECT_EQ(t1.shape().num_elements(), 1 * 2 * 3 * 4);
|
||||
EXPECT_TRUE(t1.shape().is_dynamic);
|
||||
|
||||
std::vector<int> t2_dims = {4, 3, 2, 3};
|
||||
Tensor t2(Tensor::ElementType::kFloat16, Tensor::Shape(t2_dims, true));
|
||||
EXPECT_EQ(t2.shape().num_elements(), 4 * 3 * 2 * 3);
|
||||
EXPECT_TRUE(t2.shape().is_dynamic);
|
||||
}
|
||||
|
||||
TEST(Cpu, TestMemoryAllocation) {
|
||||
Tensor t1(Tensor::ElementType::kFloat32, Tensor::Shape{4, 3, 2, 3});
|
||||
auto v1 = t1.GetCpuWriteView();
|
||||
|
||||
Reference in New Issue
Block a user