|
17 | 17 |
|
18 | 18 | import {BackendTimer, BackendTimingInfo} from './backends/backend'; |
19 | 19 | import * as tf from './index'; |
20 | | -import {describeWithFlags, SYNC_BACKEND_ENVS} from './jasmine_util'; |
| 20 | +import {ALL_ENVS, describeWithFlags, SYNC_BACKEND_ENVS} from './jasmine_util'; |
21 | 21 | import {checkComputationForErrors, KernelProfile, Logger, Profiler} from './profiler'; |
22 | 22 | import {Tensor} from './tensor'; |
23 | 23 | import {NamedTensorMap} from './tensor_types'; |
@@ -217,3 +217,28 @@ describe('profiler.checkComputationForErrors', () => { |
217 | 217 | .toBe(false); |
218 | 218 | }); |
219 | 219 | }); |
| 220 | + |
| 221 | +describeWithFlags('profiler.Logger', ALL_ENVS, () => { |
| 222 | + it('skips logging for undefined input node in input tensor map', () => { |
| 223 | + const kernelName = 'FusedConv2D'; |
| 224 | + const vals = new Float32Array(1); |
| 225 | + const outputs = tf.tensor1d([1]); |
| 226 | + const timeMs = 10; |
| 227 | + const inputs: NamedTensorMap = { |
| 228 | + 'x': tf.tensor1d([1]), |
| 229 | + 'filter': tf.tensor1d([1]), |
| 230 | + 'bias': tf.tensor1d([1]), |
| 231 | + 'preluActivationWeights': undefined |
| 232 | + }; |
| 233 | + const extraInfo = ''; |
| 234 | + const logger = new Logger(); |
| 235 | + spyOn(console, 'log'); |
| 236 | + const consoleLogSpy = console.log as jasmine.Spy; |
| 237 | + |
| 238 | + logger.logKernelProfile( |
| 239 | + kernelName, outputs, vals, timeMs, inputs, extraInfo); |
| 240 | + |
| 241 | + expect(consoleLogSpy.calls.first().args) |
| 242 | + .not.toContain('preluActivationWeights'); |
| 243 | + }); |
| 244 | +}); |
0 commit comments