| 76 | }; |
| 77 | |
| 78 | TEST_F(SummaryAudioOpTest, Basic3D) { |
| 79 | const float kSampleRate = 44100.0f; |
| 80 | const int kMaxOutputs = 3; |
| 81 | MakeOp(kMaxOutputs); |
| 82 | |
| 83 | // Feed and run |
| 84 | AddInputFromArray<tstring>(TensorShape({}), {"tag"}); |
| 85 | AddInputFromArray<float>(TensorShape({4, 2, 2}), |
| 86 | {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, |
| 87 | 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}); |
| 88 | AddInputFromArray<float>(TensorShape({}), {kSampleRate}); |
| 89 | |
| 90 | TF_ASSERT_OK(RunOpKernel()); |
| 91 | |
| 92 | // Check the output size. |
| 93 | Tensor* out_tensor = GetOutput(0); |
| 94 | ASSERT_EQ(0, out_tensor->dims()); |
| 95 | Summary summary; |
| 96 | ParseProtoUnlimited(&summary, out_tensor->scalar<tstring>()()); |
| 97 | |
| 98 | CheckAndRemoveEncodedAudio(&summary); |
| 99 | EXPECT_SummaryMatches(summary, R"( |
| 100 | value { tag: 'tag/audio/0' |
| 101 | audio { content_type: "audio/wav" sample_rate: 44100 num_channels: 2 |
| 102 | length_frames: 2 } } |
| 103 | value { tag: 'tag/audio/1' |
| 104 | audio { content_type: "audio/wav" sample_rate: 44100 num_channels: 2 |
| 105 | length_frames: 2 } } |
| 106 | value { tag: 'tag/audio/2' |
| 107 | audio { content_type: "audio/wav" sample_rate: 44100 num_channels: 2 |
| 108 | length_frames: 2 } } |
| 109 | )"); |
| 110 | } |
| 111 | |
| 112 | TEST_F(SummaryAudioOpTest, Basic2D) { |
| 113 | const float kSampleRate = 44100.0f; |
nothing calls this directly
no test coverage detected