MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST

Function TEST

tensorflow/compiler/tf2tensorrt/convert/convert_nodes_test.cc:250–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250TEST(TRT_ShapedWeights_Test, Basic) {
251 // Test constructor with no arguments.
252 {
253 TRT_ShapedWeights weights;
254 TRT_ShapedWeights copy(weights);
255 for (auto ptr : {&weights, &copy}) {
256 nvinfer1::Weights trt_weights = ptr->GetTrtWeights();
257 EXPECT_EQ(nvinfer1::DataType::kFLOAT, trt_weights.type);
258 EXPECT_EQ(nullptr, trt_weights.values);
259 EXPECT_EQ(0, trt_weights.count);
260
261 EXPECT_EQ(nullptr, ptr->GetValues());
262 EXPECT_EQ(0, ptr->count());
263 EXPECT_EQ(0, ptr->size_bytes());
264 }
265 }
266 // Test constructor with DataType argument.
267 {
268 TRT_ShapedWeights weights(nvinfer1::DataType::kFLOAT);
269 TRT_ShapedWeights copy(weights);
270 for (auto ptr : {&weights, &copy}) {
271 nvinfer1::Weights trt_weights = ptr->GetTrtWeights();
272 EXPECT_EQ(nvinfer1::DataType::kFLOAT, trt_weights.type);
273 EXPECT_EQ(nullptr, trt_weights.values);
274 EXPECT_EQ(0, trt_weights.count);
275
276 EXPECT_EQ(nullptr, ptr->GetValues());
277 EXPECT_EQ(0, ptr->count());
278 EXPECT_EQ(0, ptr->size_bytes());
279 }
280 }
281 // Test constructor with DataType and nvinfer1::Dims arguments.
282 {
283 TrtWeightStore store;
284 TRT_ShapedWeights weights =
285 store.GetTempWeights(nvinfer1::DataType::kFLOAT, GetTestDims({2, 5}));
286 TRT_ShapedWeights copy(weights);
287 for (auto ptr : {&weights, &copy}) {
288 nvinfer1::Weights trt_weights = ptr->GetTrtWeights();
289 EXPECT_EQ(nvinfer1::DataType::kFLOAT, trt_weights.type);
290 EXPECT_NE(nullptr, trt_weights.values);
291 EXPECT_EQ(10, trt_weights.count);
292
293 EXPECT_EQ(trt_weights.values, ptr->GetValues());
294 EXPECT_EQ(10, ptr->count());
295 EXPECT_EQ(40, ptr->size_bytes());
296 }
297 // Test that it doesn't copy the underlying buffer.
298 EXPECT_EQ(weights.GetValues(), copy.GetValues());
299 }
300}
301
302TEST(TRT_TensorOrWeights_Test, Basic) {
303 // Test constructor with no arguments.

Callers

nothing calls this directly

Calls 15

GetTestDimsFunction · 0.85
ExpectTrtDimsEqualsArrayFunction · 0.85
TrtShapedWeightsEqualsFunction · 0.85
MakeShapeFunction · 0.85
FakeQuantWithMinMaxArgsFunction · 0.85
GetTrtWeightsMethod · 0.80
is_tensorMethod · 0.80
is_weightsMethod · 0.80
simple_tensorMethod · 0.80
GetTrtDimsMethod · 0.80
WithOpNameMethod · 0.80
IsTensorRTCandidateMethod · 0.80

Tested by

no test coverage detected