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

Function TEST_F

tensorflow/core/kernels/save_v2_op_test.cc:52–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50};
51
52TEST_F(SaveV2OpTest, Simple) {
53 const string prefix = io::JoinPath(testing::TmpDir(), "tensor_simple");
54 const string tensornames[] = {
55 "tensor_bool", "tensor_int", "tensor_float", "tensor_double",
56 "tensor_qint8", "tensor_qint32", "tensor_uint8", "tensor_int8",
57 "tensor_int16", "tensor_int64", "tensor_complex64", "tensor_complex128",
58 "tensor_half"};
59
60 MakeOp();
61 // Add a file name
62 AddInput<tstring>(TensorShape({}),
63 [&prefix](int x) -> tstring { return prefix; });
64
65 // Add the tensor names
66 AddInput<tstring>(TensorShape({13}), [&tensornames](int x) -> tstring {
67 return tensornames[x];
68 });
69
70 // Add the slice specs
71 AddInput<tstring>(TensorShape({13}),
72 [](int x) -> tstring { return "" /* saves in full */; });
73
74 // Add a 1-d bool tensor
75 AddInput<bool>(TensorShape({2}), [](int x) -> bool { return x != 0; });
76
77 // Add a 1-d integer tensor
78 AddInput<int32>(TensorShape({10}), [](int x) -> int32 { return x + 1; });
79
80 // Add a 2-d float tensor
81 AddInput<float>(TensorShape({2, 4}),
82 [](int x) -> float { return static_cast<float>(x) / 10; });
83
84 // Add a 2-d double tensor
85 AddInput<double>(TensorShape({2, 4}),
86 [](int x) -> double { return static_cast<double>(x) / 20; });
87
88 // Add a 2-d qint8 tensor
89 AddInput<qint8>(TensorShape({3, 2}),
90 [](int x) -> qint8 { return *reinterpret_cast<qint8*>(&x); });
91
92 // Add a 2-d qint32 tensor
93 AddInput<qint32>(TensorShape({2, 3}), [](int x) -> qint32 {
94 return *reinterpret_cast<qint32*>(&x) * qint8(2);
95 });
96
97 // Add a 1-d uint8 tensor
98 AddInput<uint8>(TensorShape({11}), [](int x) -> uint8 { return x + 1; });
99
100 // Add a 1-d int8 tensor
101 AddInput<int8>(TensorShape({7}), [](int x) -> int8 { return x - 7; });
102
103 // Add a 1-d int16 tensor
104 AddInput<int16>(TensorShape({7}), [](int x) -> int16 { return x - 8; });
105
106 // Add a 1-d int64 tensor
107 AddInput<int64>(TensorShape({9}), [](int x) -> int64 { return x - 9; });
108
109 // Add a 2-d complex64 tensor

Callers

nothing calls this directly

Calls 10

TmpDirFunction · 0.85
DefaultFunction · 0.85
LookupTensorShapeMethod · 0.80
JoinPathFunction · 0.50
TensorShapeClass · 0.50
halfClass · 0.50
statusMethod · 0.45
IsSameSizeMethod · 0.45
LookupMethod · 0.45
dtypeMethod · 0.45

Tested by

no test coverage detected