UNPKG

2.57 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2019 Google Inc. All Rights Reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 * =============================================================================
16 */
17import { Scalar, Tensor } from '@tensorflow/tfjs';
18import { NodeJSKernelBackend } from './nodejs_kernel_backend';
19export declare class SummaryFileWriter {
20 private readonly resourceHandle;
21 backend: NodeJSKernelBackend;
22 constructor(resourceHandle: Tensor);
23 /**
24 * Write a scalar summary.
25 *
26 * @param name A name of the summary. The summary tag for TensorBoard will be
27 * this name.
28 * @param value A real numeric scalar value, as `tf.Scalar` or a JavaScript
29 * `number`.
30 * @param step Required `int64`-castable, monotically-increasing step value.
31 * @param description Optinal long-form description for this summary, as a
32 * `string`. *Not implemented yet*.
33 */
34 scalar(name: string, value: Scalar | number, step: number, description?: string): void;
35 /**
36 * Force summary writer to send all buffered data to storage.
37 */
38 flush(): void;
39}
40/**
41 * Create a summary file writer for TensorBoard.
42 *
43 * Example:
44 * ```js
45 * const tf = require('@tensorflow/tfjs-node');
46 *
47 * const summaryWriter = tf.node.summaryFileWriter('/tmp/tfjs_tb_logdir');
48 *
49 * for (let step = 0; step < 100; ++step) {
50 * summaryWriter.scalar('dummyValue', Math.sin(2 * Math.PI * step / 8), step);
51 * }
52 * ```
53 *
54 * @param logdir Log directory in which the summary data will be written.
55 * @param maxQueue Maximum queue length (default: `10`).
56 * @param flushMillis Flush every __ milliseconds (default: `120e3`, i.e,
57 * `120` seconds).
58 * @param filenameSuffix Suffix of the protocol buffer file names to be
59 * written in the `logdir` (default: `.v2`).
60 * @returns An instance of `SummaryFileWriter`.
61 */
62/**
63 * @doc {heading: 'TensorBoard', namespace: 'node'}
64 */
65export declare function summaryFileWriter(logdir: string, maxQueue?: number, flushMillis?: number, filenameSuffix?: string): SummaryFileWriter;
66
\No newline at end of file