Socket
Socket
Sign inDemoInstall

@tensorflow/tfjs-layers

Package Overview
Dependencies
Maintainers
11
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tensorflow/tfjs-layers - npm Package Compare versions

Comparing version 0.7.0 to 0.7.1

dist/activations_test.js.map

2

dist/base_callbacks.d.ts
import { Tensor } from '@tensorflow/tfjs-core';
import { Container } from './engine/topology';
import { Container } from './engine/container';
import { Logs, UnresolvedLogs } from './logs';

@@ -4,0 +4,0 @@ export declare type Params = {

import { BaseCallback } from './base_callbacks';
import { Container } from './engine/topology';
import { Container } from './engine/container';
import { Model } from './engine/training';

@@ -4,0 +4,0 @@ export declare abstract class Callback extends BaseCallback {

@@ -12,8 +12,2 @@ "use strict";

})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -36,5 +30,2 @@ var tfc = require("@tensorflow/tfjs-core");

};
Constraint = __decorate([
tfjs_core_1.doc({ heading: 'Constraints', subheading: 'Classes', namespace: 'constraints' })
], Constraint);
return Constraint;

@@ -41,0 +32,0 @@ }(tfjs_core_1.serialization.Serializable));

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tfjs_core_1 = require("@tensorflow/tfjs-core");
var errors_1 = require("../errors");
var topology_1 = require("./topology");
var input_layer_1 = require("./input_layer");
function assertFeedCompatibility(key, val) {
if (key.dtype != null && key.dtype !== val.dtype) {
throw new errors_1.ValueError("The dtype of the feed (" + val.dtype + ") is incompatible with that of " +
("the key '" + key.name + "' (" + key.dtype + ")."));
}
if (key.shape != null) {

@@ -22,2 +19,12 @@ if (key.shape.length !== val.shape.length) {

}
if (key.dtype == null || key.dtype === val.dtype) {
return val;
}
try {
return tfjs_core_1.cast(val, key.dtype);
}
catch (err) {
throw new errors_1.ValueError("The dtype of the feed (" + val.dtype + ") can not be cast to the dtype " +
("of the key '" + key.name + "' (" + key.dtype + ")."));
}
}

@@ -43,5 +50,4 @@ var FeedDict = (function () {

FeedDict.prototype.add = function (key, value) {
assertFeedCompatibility(key, value);
if (this.id2Value[key.id] == null) {
this.id2Value[key.id] = value;
this.id2Value[key.id] = assertFeedCompatibility(key, value);
}

@@ -86,5 +92,5 @@ else {

}
if (fetch.sourceLayer instanceof topology_1.InputLayer) {
if (fetch.sourceLayer instanceof input_layer_1.InputLayer) {
throw new errors_1.ValueError("Missing a feed value for SymbolicTensor from InputLayer " +
("'" + topology_1.InputLayer.name + "'"));
("'" + input_layer_1.InputLayer.name + "'"));
}

@@ -91,0 +97,0 @@ var inputs = fetch.inputs;

@@ -5,3 +5,3 @@ import { DataType, Scalar, serialization, Tensor } from '@tensorflow/tfjs-core';

import { Regularizer } from '../regularizers';
import { JsonDict, Kwargs, NamedTensorMap, RegularizerFn, Shape } from '../types';
import { Kwargs, RegularizerFn, Shape } from '../types';
import { LayerVariable } from '../variables';

@@ -127,2 +127,3 @@ export declare type Op = (x: LayerVariable) => LayerVariable;

apply(inputs: Tensor | Tensor[] | SymbolicTensor | SymbolicTensor[], kwargs?: Kwargs): Tensor | Tensor[] | SymbolicTensor | SymbolicTensor[];
protected warnOnIncompatibleInputShape(inputShape: Shape): void;
readonly outputShape: Shape | Shape[];

@@ -140,74 +141,2 @@ countParams(): number;

}
export interface InputLayerConfig {
inputShape?: Shape;
batchSize?: number;
batchInputShape?: Shape;
dtype?: DataType;
sparse?: boolean;
name?: string;
}
export declare class InputLayer extends Layer {
static readonly className: string;
sparse: boolean;
constructor(config: InputLayerConfig);
apply(inputs: Tensor | Tensor[] | SymbolicTensor | SymbolicTensor[], kwargs?: Kwargs): Tensor | Tensor[] | SymbolicTensor;
getConfig(): serialization.ConfigDict;
}
export interface InputConfig {
shape?: Shape;
batchShape?: Shape;
name?: string;
dtype?: DataType;
sparse?: boolean;
}
export declare function Input(config: InputConfig): SymbolicTensor;
export interface ContainerConfig {
inputs: SymbolicTensor | SymbolicTensor[];
outputs: SymbolicTensor | SymbolicTensor[];
name?: string;
}
export declare abstract class Container extends Layer {
inputs: SymbolicTensor[];
outputs: SymbolicTensor[];
inputLayers: Layer[];
inputLayersNodeIndices: number[];
inputLayersTensorIndices: number[];
outputLayers: Layer[];
outputLayersNodeIndices: number[];
outputLayersTensorIndices: number[];
layers: Layer[];
layersByDepth: {
[depth: string]: Layer[];
};
nodesByDepth: {
[depth: string]: Node[];
};
containerNodes: Set<string>;
inputNames: string[];
outputNames: string[];
feedInputShapes: Shape[];
protected internalInputShapes: Shape[];
protected internalOutputShapes: Shape[];
protected feedInputNames: string[];
protected feedOutputNames: string[];
constructor(config: ContainerConfig);
readonly trainableWeights: LayerVariable[];
readonly nonTrainableWeights: LayerVariable[];
readonly weights: LayerVariable[];
loadWeights(weightsJSON: JsonDict | NamedTensorMap, skipMismatch?: boolean, isNamedTensorMap?: boolean): void;
private updatedConfig();
toJSON(unused?: any, returnString?: boolean): string | JsonDict;
call(inputs: Tensor | Tensor[], kwargs: Kwargs): Tensor | Tensor[];
computeMask(inputs: Tensor | Tensor[], mask?: Tensor | Tensor[]): Tensor | Tensor[];
computeOutputShape(inputShape: Shape | Shape[]): Shape | Shape[];
protected runInternalGraph(inputs: Tensor[], masks?: Tensor[]): [Tensor[], Tensor[], Shape[]];
private buildNodeConversionMap(layers);
getLayer(name?: string, index?: number): Layer;
calculateLosses(): Scalar[];
getConfig(): serialization.ConfigDict;
static fromConfig<T extends serialization.Serializable>(cls: serialization.SerializableConstructor<T>, config: serialization.ConfigDict): T;
readonly stateful: boolean;
}
export declare function getSourceInputs(tensor: SymbolicTensor, layer?: Layer, nodeIndex?: number): SymbolicTensor[];
export declare function loadWeightsFromNamedTensorMap(weights: NamedTensorMap, layers: Layer[]): void;
export declare function loadWeightsFromJson(weightsJSON: JsonDict, layers: Layer[], skipMismatch?: boolean): void;

@@ -5,3 +5,3 @@ import * as tfc from '@tensorflow/tfjs-core';

import { LossOrMetricFn, NamedTensorMap, Shape } from '../types';
import { Container, ContainerConfig } from './topology';
import { Container, ContainerConfig } from './container';
export declare function isDataTensor(x: Tensor | Tensor[] | {

@@ -49,2 +49,3 @@ [inputName: string]: Tensor;

validationSteps?: number;
yieldEvery?: 'batch' | 'epoch' | 'never';
}

@@ -51,0 +52,0 @@ export interface ModelCompileConfig {

@@ -12,8 +12,2 @@ "use strict";

})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -69,4 +63,4 @@ return new (P || (P = Promise))(function (resolve, reject) {

var math_utils_1 = require("../utils/math_utils");
var container_1 = require("./container");
var executor_1 = require("./executor");
var topology_1 = require("./topology");
function isDataTensor(x) {

@@ -729,3 +723,2 @@ return x instanceof tfjs_core_1.Tensor;

Model.prototype.fitLoop = function (f, ins, outLabels, batchSize, epochs, verbose, callbacks, valF, valIns, shuffle, callbackMetrics, initialEpoch, stepsPerEpoch, validationSteps) {
if (initialEpoch === void 0) { initialEpoch = 0; }
return __awaiter(this, void 0, void 0, function () {

@@ -779,2 +772,3 @@ var _this = this;

epochs: epochs,
initialEpoch: initialEpoch,
steps: stepsPerEpoch,

@@ -1101,3 +1095,3 @@ verbose: verbose,

callbacks = base_callbacks_1.standardizeCallbacks(config.callbacks);
return [4, this.fitLoop(trainFunction, ins, outLabels, batchSize, config.epochs, config.verbose, callbacks, valFunction, valIns, config.shuffle, callbackMetrics, null, null, null)];
return [4, this.fitLoop(trainFunction, ins, outLabels, batchSize, config.epochs, config.verbose, callbacks, valFunction, valIns, config.shuffle, callbackMetrics, config.initialEpoch, null, null)];
case 1:

@@ -1165,30 +1159,6 @@ out = _a.sent();

Model.className = 'Model';
__decorate([
tfjs_core_1.doc({ heading: 'Models', subheading: 'Classes' })
], Model.prototype, "summary", null);
__decorate([
tfjs_core_1.doc({ heading: 'Models', subheading: 'Classes', configParamIndices: [0] })
], Model.prototype, "compile", null);
__decorate([
tfjs_core_1.doc({ heading: 'Models', subheading: 'Classes', configParamIndices: [2] })
], Model.prototype, "evaluate", null);
__decorate([
tfjs_core_1.doc({ heading: 'Models', subheading: 'Classes', configParamIndices: [1] })
], Model.prototype, "predict", null);
__decorate([
tfjs_core_1.doc({ heading: 'Models', subheading: 'Classes' })
], Model.prototype, "predictOnBatch", null);
__decorate([
tfjs_core_1.doc({ heading: 'Models', subheading: 'Classes', configParamIndices: [2] })
], Model.prototype, "fit", null);
__decorate([
tfjs_core_1.doc({ heading: 'Models', subheading: 'Classes', configParamIndices: [1] })
], Model.prototype, "save", null);
Model = __decorate([
tfjs_core_1.doc({ heading: 'Models', subheading: 'Classes' })
], Model);
return Model;
}(topology_1.Container));
}(container_1.Container));
exports.Model = Model;
tfjs_core_1.serialization.SerializationMap.register(Model);
//# sourceMappingURL=training.js.map

@@ -1,119 +0,10 @@

import { io, Tensor } from '@tensorflow/tfjs-core';
import { Constraint, MaxNormConfig, MinMaxNormConfig, UnitNormConfig } from './constraints';
import { ContainerConfig, InputConfig, InputLayerConfig, Layer, LayerConfig, SymbolicTensor } from './engine/topology';
import { io } from '@tensorflow/tfjs-core';
import { ContainerConfig } from './engine/container';
import { InputConfig } from './engine/input_layer';
import { SymbolicTensor } from './engine/topology';
import { Model } from './engine/training';
import { ConstantConfig, IdentityConfig, Initializer, OrthogonalConfig, RandomNormalConfig, RandomUniformConfig, SeedOnlyInitializerConfig, TruncatedNormalConfig, VarianceScalingConfig, Zeros } from './initializers';
import { ELULayerConfig, LeakyReLULayerConfig, SoftmaxLayerConfig, ThresholdedReLULayerConfig } from './layers/advanced_activations';
import { ConvLayerConfig, Cropping2DLayerConfig, SeparableConvLayerConfig, UpSampling2DLayerConfig } from './layers/convolutional';
import { DepthwiseConv2DLayerConfig } from './layers/convolutional_depthwise';
import { ActivationLayerConfig, DenseLayerConfig, DropoutLayerConfig, RepeatVectorLayerConfig, ReshapeLayerConfig } from './layers/core';
import { EmbeddingLayerConfig } from './layers/embeddings';
import { ConcatenateLayerConfig } from './layers/merge';
import { BatchNormalizationLayerConfig } from './layers/normalization';
import { ZeroPadding2DLayerConfig } from './layers/padding';
import { GlobalPooling2DLayerConfig, Pooling1DLayerConfig, Pooling2DLayerConfig } from './layers/pooling';
import { GRUCellLayerConfig, GRULayerConfig, LSTMCellLayerConfig, LSTMLayerConfig, RNN, RNNCell, RNNLayerConfig, SimpleRNNCellLayerConfig, SimpleRNNLayerConfig, StackedRNNCellsConfig } from './layers/recurrent';
import { BidirectionalLayerConfig, Wrapper, WrapperLayerConfig } from './layers/wrappers';
import { Sequential, SequentialConfig } from './models';
import { L1Config, L1L2Config, L2Config, Regularizer } from './regularizers';
export declare class ModelExports {
static model(config: ContainerConfig): Model;
static sequential(config?: SequentialConfig): Sequential;
static loadModel(pathOrIOHandler: string | io.IOHandler): Promise<Model>;
static input(config: InputConfig): SymbolicTensor;
}
export declare class LayerExports {
static Layer: typeof Layer;
static RNN: typeof RNN;
static RNNCell: typeof RNNCell;
static inputLayer(config: InputLayerConfig): Layer;
static input: typeof ModelExports.input;
static elu(config?: ELULayerConfig): Layer;
static leakyReLU(config?: LeakyReLULayerConfig): Layer;
static softmax(config?: SoftmaxLayerConfig): Layer;
static thresholdedReLU(config?: ThresholdedReLULayerConfig): Layer;
static conv1d(config: ConvLayerConfig): Layer;
static conv2d(config: ConvLayerConfig): Layer;
static conv2dTranspose(config: ConvLayerConfig): Layer;
static separableConv2d(config: SeparableConvLayerConfig): Layer;
static cropping2D(config: Cropping2DLayerConfig): Layer;
static upSampling2d(config: UpSampling2DLayerConfig): Layer;
static depthwiseConv2d(config: DepthwiseConv2DLayerConfig): Layer;
static activation(config: ActivationLayerConfig): Layer;
static dense(config: DenseLayerConfig): Layer;
static dropout(config: DropoutLayerConfig): Layer;
static flatten(config?: LayerConfig): Layer;
static repeatVector(config: RepeatVectorLayerConfig): Layer;
static reshape(config: ReshapeLayerConfig): Layer;
static embedding(config: EmbeddingLayerConfig): Layer;
static add(config?: LayerConfig): Layer;
static average(config?: LayerConfig): Layer;
static concatenate(config?: ConcatenateLayerConfig): Layer;
static maximum(config?: LayerConfig): Layer;
static minimum(config?: LayerConfig): Layer;
static multiply(config?: LayerConfig): Layer;
static batchNormalization(config: BatchNormalizationLayerConfig): Layer;
static zeroPadding2d(config?: ZeroPadding2DLayerConfig): Layer;
static averagePooling1d(config: Pooling1DLayerConfig): Layer;
static avgPool1d(config: Pooling1DLayerConfig): Layer;
static avgPooling1d(config: Pooling1DLayerConfig): Layer;
static averagePooling2d(config: Pooling2DLayerConfig): Layer;
static avgPool2d(config: Pooling2DLayerConfig): Layer;
static avgPooling2d(config: Pooling2DLayerConfig): Layer;
static globalAveragePooling1d(config: LayerConfig): Layer;
static globalAveragePooling2d(config: GlobalPooling2DLayerConfig): Layer;
static globalMaxPooling1d(config: LayerConfig): Layer;
static globalMaxPooling2d(config: GlobalPooling2DLayerConfig): Layer;
static maxPooling1d(config: Pooling1DLayerConfig): Layer;
static maxPooling2d(config: Pooling2DLayerConfig): Layer;
static gru(config: GRULayerConfig): Layer;
static gruCell(config: GRUCellLayerConfig): RNNCell;
static lstm(config: LSTMLayerConfig): Layer;
static lstmCell(config: LSTMCellLayerConfig): RNNCell;
static simpleRNN(config: SimpleRNNLayerConfig): Layer;
static simpleRNNCell(config: SimpleRNNCellLayerConfig): RNNCell;
static rnn(config: RNNLayerConfig): Layer;
static stackedRNNCells(config: StackedRNNCellsConfig): RNNCell;
static bidirectional(config: BidirectionalLayerConfig): Wrapper;
static timeDistributed(config: WrapperLayerConfig): Layer;
}
export declare class ConstraintExports {
static maxNorm(config: MaxNormConfig): Constraint;
static unitNorm(config: UnitNormConfig): Constraint;
static nonNeg(): Constraint;
static minMaxNorm(config: MinMaxNormConfig): Constraint;
}
export declare class InitializerExports {
static zeros(): Zeros;
static ones(): Initializer;
static constant(config: ConstantConfig): Initializer;
static randomUniform(config: RandomUniformConfig): Initializer;
static randomNormal(config: RandomNormalConfig): Initializer;
static truncatedNormal(config: TruncatedNormalConfig): Initializer;
static identity(config: IdentityConfig): Initializer;
static varianceScaling(config: VarianceScalingConfig): Initializer;
static glorotUniform(config: SeedOnlyInitializerConfig): Initializer;
static glorotNormal(config: SeedOnlyInitializerConfig): Initializer;
static heNormal(config: SeedOnlyInitializerConfig): Initializer;
static leCunNormal(config: SeedOnlyInitializerConfig): Initializer;
static orthogonal(config: OrthogonalConfig): Initializer;
}
export declare class MetricExports {
static binaryAccuracy(yTrue: Tensor, yPred: Tensor): Tensor;
static binaryCrossentropy(yTrue: Tensor, yPred: Tensor): Tensor;
static categoricalAccuracy(yTrue: Tensor, yPred: Tensor): Tensor;
static categoricalCrossentropy(yTrue: Tensor, yPred: Tensor): Tensor;
static cosineProximity(yTrue: Tensor, yPred: Tensor): Tensor;
meanAbsoluteError(yTrue: Tensor, yPred: Tensor): Tensor;
meanAbsolutePercentageError(yTrue: Tensor, yPred: Tensor): Tensor;
MAPE(yTrue: Tensor, yPred: Tensor): Tensor;
mape(yTrue: Tensor, yPred: Tensor): Tensor;
static meanSquaredError(yTrue: Tensor, yPred: Tensor): Tensor;
static MSE(yTrue: Tensor, yPred: Tensor): Tensor;
static mse(yTrue: Tensor, yPred: Tensor): Tensor;
}
export declare class RegularizerExports {
static l1l2(config?: L1L2Config): Regularizer;
static l1(config?: L1Config): Regularizer;
static l2(config?: L2Config): Regularizer;
}
export declare function model(config: ContainerConfig): Model;
export declare function sequential(config?: SequentialConfig): Sequential;
export declare function loadModel(pathOrIOHandler: string | io.IOHandler): Promise<Model>;
export declare function input(config: InputConfig): SymbolicTensor;
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var tfjs_core_1 = require("@tensorflow/tfjs-core");
var constraints_1 = require("./constraints");
var topology_1 = require("./engine/topology");
var input_layer_1 = require("./engine/input_layer");
var training_1 = require("./engine/training");
var initializers_1 = require("./initializers");
var advanced_activations_1 = require("./layers/advanced_activations");
var convolutional_1 = require("./layers/convolutional");
var convolutional_depthwise_1 = require("./layers/convolutional_depthwise");
var core_1 = require("./layers/core");
var embeddings_1 = require("./layers/embeddings");
var merge_1 = require("./layers/merge");
var normalization_1 = require("./layers/normalization");
var padding_1 = require("./layers/padding");
var pooling_1 = require("./layers/pooling");
var recurrent_1 = require("./layers/recurrent");
var wrappers_1 = require("./layers/wrappers");
var losses_1 = require("./losses");
var metrics_1 = require("./metrics");
var models_1 = require("./models");
var regularizers_1 = require("./regularizers");
var ModelExports = (function () {
function ModelExports() {
}
ModelExports.model = function (config) {
return new training_1.Model(config);
};
ModelExports.sequential = function (config) {
return new models_1.Sequential(config);
};
ModelExports.loadModel = function (pathOrIOHandler) {
return models_1.loadModelInternal(pathOrIOHandler);
};
ModelExports.input = function (config) {
return topology_1.Input(config);
};
__decorate([
tfjs_core_1.doc({ heading: 'Models', subheading: 'Creation', configParamIndices: [0] })
], ModelExports, "model", null);
__decorate([
tfjs_core_1.doc({ heading: 'Models', subheading: 'Creation', configParamIndices: [0] })
], ModelExports, "sequential", null);
__decorate([
tfjs_core_1.doc({
heading: 'Models',
subheading: 'Loading',
useDocsFrom: 'loadModelInternal'
})
], ModelExports, "loadModel", null);
__decorate([
tfjs_core_1.doc({
heading: 'Models',
subheading: 'Inputs',
useDocsFrom: 'Input',
configParamIndices: [0]
})
], ModelExports, "input", null);
return ModelExports;
}());
exports.ModelExports = ModelExports;
var LayerExports = (function () {
function LayerExports() {
}
LayerExports.inputLayer = function (config) {
return new topology_1.InputLayer(config);
};
LayerExports.elu = function (config) {
return new advanced_activations_1.ELU(config);
};
LayerExports.leakyReLU = function (config) {
return new advanced_activations_1.LeakyReLU(config);
};
LayerExports.softmax = function (config) {
return new advanced_activations_1.Softmax(config);
};
LayerExports.thresholdedReLU = function (config) {
return new advanced_activations_1.ThresholdedReLU(config);
};
LayerExports.conv1d = function (config) {
return new convolutional_1.Conv1D(config);
};
LayerExports.conv2d = function (config) {
return new convolutional_1.Conv2D(config);
};
LayerExports.conv2dTranspose = function (config) {
return new convolutional_1.Conv2DTranspose(config);
};
LayerExports.separableConv2d = function (config) {
return new convolutional_1.SeparableConv2D(config);
};
LayerExports.cropping2D = function (config) {
return new convolutional_1.Cropping2D(config);
};
LayerExports.upSampling2d = function (config) {
return new convolutional_1.UpSampling2D(config);
};
LayerExports.depthwiseConv2d = function (config) {
return new convolutional_depthwise_1.DepthwiseConv2D(config);
};
LayerExports.activation = function (config) {
return new core_1.Activation(config);
};
LayerExports.dense = function (config) {
return new core_1.Dense(config);
};
LayerExports.dropout = function (config) {
return new core_1.Dropout(config);
};
LayerExports.flatten = function (config) {
return new core_1.Flatten(config);
};
LayerExports.repeatVector = function (config) {
return new core_1.RepeatVector(config);
};
LayerExports.reshape = function (config) {
return new core_1.Reshape(config);
};
LayerExports.embedding = function (config) {
return new embeddings_1.Embedding(config);
};
LayerExports.add = function (config) {
return new merge_1.Add(config);
};
LayerExports.average = function (config) {
return new merge_1.Average(config);
};
LayerExports.concatenate = function (config) {
return new merge_1.Concatenate(config);
};
LayerExports.maximum = function (config) {
return new merge_1.Maximum(config);
};
LayerExports.minimum = function (config) {
return new merge_1.Minimum(config);
};
LayerExports.multiply = function (config) {
return new merge_1.Multiply(config);
};
LayerExports.batchNormalization = function (config) {
return new normalization_1.BatchNormalization(config);
};
LayerExports.zeroPadding2d = function (config) {
return new padding_1.ZeroPadding2D(config);
};
LayerExports.averagePooling1d = function (config) {
return new pooling_1.AveragePooling1D(config);
};
LayerExports.avgPool1d = function (config) {
return LayerExports.averagePooling1d(config);
};
LayerExports.avgPooling1d = function (config) {
return LayerExports.averagePooling1d(config);
};
LayerExports.averagePooling2d = function (config) {
return new pooling_1.AveragePooling2D(config);
};
LayerExports.avgPool2d = function (config) {
return LayerExports.averagePooling2d(config);
};
LayerExports.avgPooling2d = function (config) {
return LayerExports.averagePooling2d(config);
};
LayerExports.globalAveragePooling1d = function (config) {
return new pooling_1.GlobalAveragePooling1D(config);
};
LayerExports.globalAveragePooling2d = function (config) {
return new pooling_1.GlobalAveragePooling2D(config);
};
LayerExports.globalMaxPooling1d = function (config) {
return new pooling_1.GlobalMaxPooling1D(config);
};
LayerExports.globalMaxPooling2d = function (config) {
return new pooling_1.GlobalMaxPooling2D(config);
};
LayerExports.maxPooling1d = function (config) {
return new pooling_1.MaxPooling1D(config);
};
LayerExports.maxPooling2d = function (config) {
return new pooling_1.MaxPooling2D(config);
};
LayerExports.gru = function (config) {
return new recurrent_1.GRU(config);
};
LayerExports.gruCell = function (config) {
return new recurrent_1.GRUCell(config);
};
LayerExports.lstm = function (config) {
return new recurrent_1.LSTM(config);
};
LayerExports.lstmCell = function (config) {
return new recurrent_1.LSTMCell(config);
};
LayerExports.simpleRNN = function (config) {
return new recurrent_1.SimpleRNN(config);
};
LayerExports.simpleRNNCell = function (config) {
return new recurrent_1.SimpleRNNCell(config);
};
LayerExports.rnn = function (config) {
return new recurrent_1.RNN(config);
};
LayerExports.stackedRNNCells = function (config) {
return new recurrent_1.StackedRNNCells(config);
};
LayerExports.bidirectional = function (config) {
return new wrappers_1.Bidirectional(config);
};
LayerExports.timeDistributed = function (config) {
return new wrappers_1.TimeDistributed(config);
};
LayerExports.Layer = topology_1.Layer;
LayerExports.RNN = recurrent_1.RNN;
LayerExports.RNNCell = recurrent_1.RNNCell;
LayerExports.input = ModelExports.input;
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Inputs',
namespace: 'layers',
useDocsFrom: 'InputLayer',
configParamIndices: [0]
})
], LayerExports, "inputLayer", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Advanced Activation',
namespace: 'layers',
useDocsFrom: 'ELU',
configParamIndices: [0]
})
], LayerExports, "elu", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Advanced Activation',
namespace: 'layers',
useDocsFrom: 'LeakyReLU',
configParamIndices: [0]
})
], LayerExports, "leakyReLU", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Advanced Activation',
namespace: 'layers',
useDocsFrom: 'Softmax',
configParamIndices: [0]
})
], LayerExports, "softmax", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Advanced Activation',
namespace: 'layers',
useDocsFrom: 'ThresholdedReLU',
configParamIndices: [0]
})
], LayerExports, "thresholdedReLU", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Convolutional',
namespace: 'layers',
useDocsFrom: 'Conv1D',
configParamIndices: [0]
})
], LayerExports, "conv1d", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Convolutional',
namespace: 'layers',
useDocsFrom: 'Conv2D',
configParamIndices: [0]
})
], LayerExports, "conv2d", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Convolutional',
namespace: 'layers',
useDocsFrom: 'Conv2DTranspose',
configParamIndices: [0]
})
], LayerExports, "conv2dTranspose", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Convolutional',
namespace: 'layers',
useDocsFrom: 'SeparableConv2D',
configParamIndices: [0]
})
], LayerExports, "separableConv2d", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Convolutional',
namespace: 'layers',
useDocsFrom: 'Cropping2D',
configParamIndices: [0]
})
], LayerExports, "cropping2D", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Convolutional',
namespace: 'layers',
useDocsFrom: 'UpSampling2D',
configParamIndices: [0]
})
], LayerExports, "upSampling2d", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Convolutional',
namespace: 'layers',
useDocsFrom: 'DepthwiseConv2D',
configParamIndices: [0]
})
], LayerExports, "depthwiseConv2d", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Basic',
namespace: 'layers',
useDocsFrom: 'Activation',
configParamIndices: [0]
})
], LayerExports, "activation", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Basic',
namespace: 'layers',
useDocsFrom: 'Dense',
configParamIndices: [0]
})
], LayerExports, "dense", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Basic',
namespace: 'layers',
useDocsFrom: 'Dropout',
configParamIndices: [0]
})
], LayerExports, "dropout", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Basic',
namespace: 'layers',
useDocsFrom: 'Flatten',
configParamIndices: [0]
})
], LayerExports, "flatten", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Basic',
namespace: 'layers',
useDocsFrom: 'RepeatVector',
configParamIndices: [0]
})
], LayerExports, "repeatVector", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Basic',
namespace: 'layers',
useDocsFrom: 'Reshape',
configParamIndices: [0]
})
], LayerExports, "reshape", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Basic',
namespace: 'layers',
useDocsFrom: 'Embedding',
configParamIndices: [0]
})
], LayerExports, "embedding", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Merge',
namespace: 'layers',
useDocsFrom: 'Add',
configParamIndices: [0]
})
], LayerExports, "add", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Merge',
namespace: 'layers',
useDocsFrom: 'Average',
configParamIndices: [0]
})
], LayerExports, "average", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Merge',
namespace: 'layers',
useDocsFrom: 'Concatenate',
configParamIndices: [0]
})
], LayerExports, "concatenate", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Merge',
namespace: 'layers',
useDocsFrom: 'Maximum',
configParamIndices: [0]
})
], LayerExports, "maximum", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Merge',
namespace: 'layers',
useDocsFrom: 'Minimum',
configParamIndices: [0]
})
], LayerExports, "minimum", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Merge',
namespace: 'layers',
useDocsFrom: 'Multiply',
configParamIndices: [0]
})
], LayerExports, "multiply", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Normalization',
namespace: 'layers',
useDocsFrom: 'BatchNormalization',
configParamIndices: [0]
})
], LayerExports, "batchNormalization", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Padding',
namespace: 'layers',
useDocsFrom: 'ZeroPadding2D',
configParamIndices: [0]
})
], LayerExports, "zeroPadding2d", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Pooling',
namespace: 'layers',
useDocsFrom: 'AveragePooling1D',
configParamIndices: [0]
})
], LayerExports, "averagePooling1d", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Pooling',
namespace: 'layers',
useDocsFrom: 'AveragePooling2D',
configParamIndices: [0]
})
], LayerExports, "averagePooling2d", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Pooling',
namespace: 'layers',
useDocsFrom: 'GlobalAveragePooling1D',
configParamIndices: [0]
})
], LayerExports, "globalAveragePooling1d", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Pooling',
namespace: 'layers',
useDocsFrom: 'GlobalAveragePooling2D',
configParamIndices: [0]
})
], LayerExports, "globalAveragePooling2d", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Pooling',
namespace: 'layers',
useDocsFrom: 'GlobalMaxPooling1D',
configParamIndices: [0]
})
], LayerExports, "globalMaxPooling1d", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Pooling',
namespace: 'layers',
useDocsFrom: 'GlobalMaxPooling2D',
configParamIndices: [0]
})
], LayerExports, "globalMaxPooling2d", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Pooling',
namespace: 'layers',
useDocsFrom: 'MaxPooling1D',
configParamIndices: [0]
})
], LayerExports, "maxPooling1d", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Pooling',
namespace: 'layers',
useDocsFrom: 'MaxPooling2D',
configParamIndices: [0]
})
], LayerExports, "maxPooling2d", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Recurrent',
namespace: 'layers',
useDocsFrom: 'GRU',
configParamIndices: [0]
})
], LayerExports, "gru", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Recurrent',
namespace: 'layers',
useDocsFrom: 'GRUCell',
configParamIndices: [0]
})
], LayerExports, "gruCell", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Recurrent',
namespace: 'layers',
useDocsFrom: 'LSTM',
configParamIndices: [0]
})
], LayerExports, "lstm", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Recurrent',
namespace: 'layers',
useDocsFrom: 'LSTMCell',
configParamIndices: [0]
})
], LayerExports, "lstmCell", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Recurrent',
namespace: 'layers',
useDocsFrom: 'SimpleRNN',
configParamIndices: [0]
})
], LayerExports, "simpleRNN", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Recurrent',
namespace: 'layers',
useDocsFrom: 'SimpleRNNCell',
configParamIndices: [0]
})
], LayerExports, "simpleRNNCell", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Recurrent',
namespace: 'layers',
useDocsFrom: 'RNN',
configParamIndices: [0]
})
], LayerExports, "rnn", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Recurrent',
namespace: 'layers',
useDocsFrom: 'RNN',
configParamIndices: [0]
})
], LayerExports, "stackedRNNCells", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Wrapper',
namespace: 'layers',
useDocsFrom: 'Bidirectional',
configParamIndices: [0]
})
], LayerExports, "bidirectional", null);
__decorate([
tfjs_core_1.doc({
heading: 'Layers',
subheading: 'Wrapper',
namespace: 'layers',
useDocsFrom: 'TimeDistributed',
configParamIndices: [0]
})
], LayerExports, "timeDistributed", null);
return LayerExports;
}());
exports.LayerExports = LayerExports;
var ConstraintExports = (function () {
function ConstraintExports() {
}
ConstraintExports.maxNorm = function (config) {
return new constraints_1.MaxNorm(config);
};
ConstraintExports.unitNorm = function (config) {
return new constraints_1.UnitNorm(config);
};
ConstraintExports.nonNeg = function () {
return new constraints_1.NonNeg();
};
ConstraintExports.minMaxNorm = function (config) {
return new constraints_1.MinMaxNorm(config);
};
__decorate([
tfjs_core_1.doc({
heading: 'Constraints',
namespace: 'constraints',
useDocsFrom: 'MaxNorm',
configParamIndices: [0]
})
], ConstraintExports, "maxNorm", null);
__decorate([
tfjs_core_1.doc({
heading: 'Constraints',
namespace: 'constraints',
useDocsFrom: 'UnitNorm',
configParamIndices: [0]
})
], ConstraintExports, "unitNorm", null);
__decorate([
tfjs_core_1.doc({ heading: 'Constraints', namespace: 'constraints', useDocsFrom: 'NonNeg' })
], ConstraintExports, "nonNeg", null);
__decorate([
tfjs_core_1.doc({
heading: 'Constraints',
namespace: 'constraints',
useDocsFrom: 'MinMaxNormConfig',
configParamIndices: [0]
})
], ConstraintExports, "minMaxNorm", null);
return ConstraintExports;
}());
exports.ConstraintExports = ConstraintExports;
var InitializerExports = (function () {
function InitializerExports() {
}
InitializerExports.zeros = function () {
return new initializers_1.Zeros();
};
InitializerExports.ones = function () {
return new initializers_1.Ones();
};
InitializerExports.constant = function (config) {
return new initializers_1.Constant(config);
};
InitializerExports.randomUniform = function (config) {
return new initializers_1.RandomUniform(config);
};
InitializerExports.randomNormal = function (config) {
return new initializers_1.RandomNormal(config);
};
InitializerExports.truncatedNormal = function (config) {
return new initializers_1.TruncatedNormal(config);
};
InitializerExports.identity = function (config) {
return new initializers_1.Identity(config);
};
InitializerExports.varianceScaling = function (config) {
return new initializers_1.VarianceScaling(config);
};
InitializerExports.glorotUniform = function (config) {
return new initializers_1.GlorotUniform(config);
};
InitializerExports.glorotNormal = function (config) {
return new initializers_1.GlorotNormal(config);
};
InitializerExports.heNormal = function (config) {
return new initializers_1.HeNormal(config);
};
InitializerExports.leCunNormal = function (config) {
return new initializers_1.LeCunNormal(config);
};
InitializerExports.orthogonal = function (config) {
return new initializers_1.Orthogonal(config);
};
__decorate([
tfjs_core_1.doc({
heading: 'Initializers',
namespace: 'initializers',
useDocsFrom: 'Zeros'
})
], InitializerExports, "zeros", null);
__decorate([
tfjs_core_1.doc({ heading: 'Initializers', namespace: 'initializers', useDocsFrom: 'Ones' })
], InitializerExports, "ones", null);
__decorate([
tfjs_core_1.doc({
heading: 'Initializers',
namespace: 'initializers',
useDocsFrom: 'Constant',
configParamIndices: [0]
})
], InitializerExports, "constant", null);
__decorate([
tfjs_core_1.doc({
heading: 'Initializers',
namespace: 'initializers',
useDocsFrom: 'RandomUniform',
configParamIndices: [0]
})
], InitializerExports, "randomUniform", null);
__decorate([
tfjs_core_1.doc({
heading: 'Initializers',
namespace: 'initializers',
useDocsFrom: 'RandomNormal',
configParamIndices: [0]
})
], InitializerExports, "randomNormal", null);
__decorate([
tfjs_core_1.doc({
heading: 'Initializers',
namespace: 'initializers',
useDocsFrom: 'TruncatedNormal',
configParamIndices: [0]
})
], InitializerExports, "truncatedNormal", null);
__decorate([
tfjs_core_1.doc({
heading: 'Initializers',
namespace: 'initializers',
useDocsFrom: 'Identity',
configParamIndices: [0]
})
], InitializerExports, "identity", null);
__decorate([
tfjs_core_1.doc({
heading: 'Initializers',
namespace: 'initializers',
useDocsFrom: 'VarianceScaling',
configParamIndices: [0]
})
], InitializerExports, "varianceScaling", null);
__decorate([
tfjs_core_1.doc({
heading: 'Initializers',
namespace: 'initializers',
useDocsFrom: 'GlorotUniform',
configParamIndices: [0]
})
], InitializerExports, "glorotUniform", null);
__decorate([
tfjs_core_1.doc({
heading: 'Initializers',
namespace: 'initializers',
useDocsFrom: 'GlorotNormal',
configParamIndices: [0]
})
], InitializerExports, "glorotNormal", null);
__decorate([
tfjs_core_1.doc({
heading: 'Initializers',
namespace: 'initializers',
useDocsFrom: 'HeNormal',
configParamIndices: [0]
})
], InitializerExports, "heNormal", null);
__decorate([
tfjs_core_1.doc({
heading: 'Initializers',
namespace: 'initializers',
useDocsFrom: 'LeCunNormal',
configParamIndices: [0]
})
], InitializerExports, "leCunNormal", null);
__decorate([
tfjs_core_1.doc({
heading: 'Initializers',
namespace: 'initializers',
useDocsFrom: 'Orthogonal',
configParamIndices: [0]
})
], InitializerExports, "orthogonal", null);
return InitializerExports;
}());
exports.InitializerExports = InitializerExports;
var MetricExports = (function () {
function MetricExports() {
}
MetricExports.binaryAccuracy = function (yTrue, yPred) {
return metrics_1.binaryAccuracy(yTrue, yPred);
};
MetricExports.binaryCrossentropy = function (yTrue, yPred) {
return metrics_1.binaryCrossentropy(yTrue, yPred);
};
MetricExports.categoricalAccuracy = function (yTrue, yPred) {
return metrics_1.categoricalAccuracy(yTrue, yPred);
};
MetricExports.categoricalCrossentropy = function (yTrue, yPred) {
return losses_1.categoricalCrossentropy(yTrue, yPred);
};
MetricExports.cosineProximity = function (yTrue, yPred) {
return losses_1.cosineProximity(yTrue, yPred);
};
MetricExports.prototype.meanAbsoluteError = function (yTrue, yPred) {
return losses_1.meanAbsoluteError(yTrue, yPred);
};
MetricExports.prototype.meanAbsolutePercentageError = function (yTrue, yPred) {
return losses_1.meanAbsolutePercentageError(yTrue, yPred);
};
MetricExports.prototype.MAPE = function (yTrue, yPred) {
return losses_1.meanAbsolutePercentageError(yTrue, yPred);
};
MetricExports.prototype.mape = function (yTrue, yPred) {
return losses_1.meanAbsolutePercentageError(yTrue, yPred);
};
MetricExports.meanSquaredError = function (yTrue, yPred) {
return losses_1.meanSquaredError(yTrue, yPred);
};
MetricExports.MSE = function (yTrue, yPred) {
return losses_1.meanSquaredError(yTrue, yPred);
};
MetricExports.mse = function (yTrue, yPred) {
return losses_1.meanSquaredError(yTrue, yPred);
};
__decorate([
tfjs_core_1.doc({
heading: 'Metrics',
namespace: 'metrics',
useDocsFrom: 'meanAbsoluteError'
})
], MetricExports.prototype, "meanAbsoluteError", null);
__decorate([
tfjs_core_1.doc({
heading: 'Metrics',
namespace: 'metrics',
useDocsFrom: 'meanAbsolutePercentageError'
})
], MetricExports.prototype, "meanAbsolutePercentageError", null);
__decorate([
tfjs_core_1.doc({ heading: 'Metrics', namespace: 'metrics', useDocsFrom: 'binaryAccuracy' })
], MetricExports, "binaryAccuracy", null);
__decorate([
tfjs_core_1.doc({
heading: 'Metrics',
namespace: 'metrics',
useDocsFrom: 'binaryCrossentropy'
})
], MetricExports, "binaryCrossentropy", null);
__decorate([
tfjs_core_1.doc({
heading: 'Metrics',
namespace: 'metrics',
useDocsFrom: 'categoricalAccuracy'
})
], MetricExports, "categoricalAccuracy", null);
__decorate([
tfjs_core_1.doc({
heading: 'Metrics',
namespace: 'metrics',
useDocsFrom: 'categoricalCrossentropy'
})
], MetricExports, "categoricalCrossentropy", null);
__decorate([
tfjs_core_1.doc({
heading: 'Metrics',
namespace: 'metrics',
useDocsFrom: 'cosineProximity'
})
], MetricExports, "cosineProximity", null);
__decorate([
tfjs_core_1.doc({
heading: 'Metrics',
namespace: 'metrics',
useDocsFrom: 'meanSquaredError'
})
], MetricExports, "meanSquaredError", null);
return MetricExports;
}());
exports.MetricExports = MetricExports;
var RegularizerExports = (function () {
function RegularizerExports() {
}
RegularizerExports.l1l2 = function (config) {
return new regularizers_1.L1L2(config);
};
RegularizerExports.l1 = function (config) {
return regularizers_1.l1(config);
};
RegularizerExports.l2 = function (config) {
return regularizers_1.l2(config);
};
__decorate([
tfjs_core_1.doc({
heading: 'Regularizers',
namespace: 'regularizers',
useDocsFrom: 'L1L2',
configParamIndices: [0]
})
], RegularizerExports, "l1l2", null);
__decorate([
tfjs_core_1.doc({
heading: 'Regularizers',
namespace: 'regularizers',
useDocsFrom: 'L1L2',
configParamIndices: [0]
})
], RegularizerExports, "l1", null);
__decorate([
tfjs_core_1.doc({
heading: 'Regularizers',
namespace: 'regularizers',
useDocsFrom: 'L1L2',
configParamIndices: [0]
})
], RegularizerExports, "l2", null);
return RegularizerExports;
}());
exports.RegularizerExports = RegularizerExports;
function model(config) {
return new training_1.Model(config);
}
exports.model = model;
function sequential(config) {
return new models_1.Sequential(config);
}
exports.sequential = sequential;
function loadModel(pathOrIOHandler) {
return models_1.loadModelInternal(pathOrIOHandler);
}
exports.loadModel = loadModel;
function input(config) {
return input_layer_1.Input(config);
}
exports.input = input;
//# sourceMappingURL=exports.js.map

@@ -1,2 +0,6 @@

import { ConstraintExports, InitializerExports, LayerExports, MetricExports, ModelExports, RegularizerExports } from './exports';
import * as constraints from './exports_constraints';
import * as initializers from './exports_initializers';
import * as layers from './exports_layers';
import * as metrics from './exports_metrics';
import * as regularizers from './exports_regularizers';
export { CallbackList, CustomCallback, CustomCallbackConfig } from './base_callbacks';

@@ -6,2 +10,3 @@ export { Callback } from './callbacks';

export { Model, ModelCompileConfig, ModelEvaluateConfig, ModelFitConfig } from './engine/training';
export { input, loadModel, model, sequential } from './exports';
export { GRUCellLayerConfig, GRULayerConfig, LSTMCellLayerConfig, LSTMLayerConfig, RNN, RNNLayerConfig, SimpleRNNCellLayerConfig, SimpleRNNLayerConfig } from './layers/recurrent';

@@ -11,11 +16,4 @@ export { Logs } from './logs';

export { Shape } from './types';
export { LayerVariable } from './variables';
export { version as version_layers } from './version';
export declare const model: typeof ModelExports.model;
export declare const sequential: typeof ModelExports.sequential;
export declare const loadModel: typeof ModelExports.loadModel;
export declare const input: typeof ModelExports.input;
export declare const layers: typeof LayerExports;
export declare const constraints: typeof ConstraintExports;
export declare const initializers: typeof InitializerExports;
export declare const metrics: typeof MetricExports;
export declare const regularizers: typeof RegularizerExports;
export { constraints, initializers, layers, metrics, regularizers };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var exports_1 = require("./exports");
var constraints = require("./exports_constraints");
exports.constraints = constraints;
var initializers = require("./exports_initializers");
exports.initializers = initializers;
var layers = require("./exports_layers");
exports.layers = layers;
var metrics = require("./exports_metrics");
exports.metrics = metrics;
var regularizers = require("./exports_regularizers");
exports.regularizers = regularizers;
var base_callbacks_1 = require("./base_callbacks");

@@ -13,2 +22,7 @@ exports.CallbackList = base_callbacks_1.CallbackList;

exports.Model = training_1.Model;
var exports_1 = require("./exports");
exports.input = exports_1.input;
exports.loadModel = exports_1.loadModel;
exports.model = exports_1.model;
exports.sequential = exports_1.sequential;
var recurrent_1 = require("./layers/recurrent");

@@ -18,13 +32,6 @@ exports.RNN = recurrent_1.RNN;

exports.Sequential = models_1.Sequential;
var variables_1 = require("./variables");
exports.LayerVariable = variables_1.LayerVariable;
var version_1 = require("./version");
exports.version_layers = version_1.version;
exports.model = exports_1.ModelExports.model;
exports.sequential = exports_1.ModelExports.sequential;
exports.loadModel = exports_1.ModelExports.loadModel;
exports.input = exports_1.ModelExports.input;
exports.layers = exports_1.LayerExports;
exports.constraints = exports_1.ConstraintExports;
exports.initializers = exports_1.InitializerExports;
exports.metrics = exports_1.MetricExports;
exports.regularizers = exports_1.RegularizerExports;
//# sourceMappingURL=index.js.map

@@ -12,13 +12,7 @@ "use strict";

})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var tfjs_core_1 = require("@tensorflow/tfjs-core");
var state_1 = require("./backend/state");
var K = require("./backend/tfjs_backend");
var common_1 = require("./common");
var state_1 = require("./backend/state");
var errors_1 = require("./errors");

@@ -48,5 +42,2 @@ var generic_utils_1 = require("./utils/generic_utils");

};
Initializer = __decorate([
tfjs_core_1.doc({ heading: 'Initializers', subheading: 'Classes', namespace: 'initializers' })
], Initializer);
return Initializer;

@@ -85,2 +76,8 @@ }(tfjs_core_1.serialization.Serializable));

var _this = _super.call(this) || this;
if (typeof config !== 'object') {
throw new errors_1.ValueError("Expected argument of type ConstantConfig but got " + config);
}
if (config.value === undefined) {
throw new errors_1.ValueError("config must have value set but got " + config);
}
_this.value = config.value;

@@ -87,0 +84,0 @@ return _this;

@@ -1,2 +0,2 @@

import { Tensor } from '@tensorflow/tfjs-core';
import { serialization, Tensor } from '@tensorflow/tfjs-core';
import { DataFormat } from '../common';

@@ -27,2 +27,3 @@ import { Constraint, ConstraintIdentifier } from '../constraints';

computeOutputShape(inputShape: Shape | Shape[]): Shape | Shape[];
getConfig(): serialization.ConfigDict;
}

@@ -116,2 +116,13 @@ "use strict";

};
DepthwiseConv2D.prototype.getConfig = function () {
var config = _super.prototype.getConfig.call(this);
config['depthMultiplier'] = this.depthMultiplier;
config['depthwiseInitializer'] =
initializers_1.serializeInitializer(this.depthwiseInitializer);
config['depthwiseRegularizer'] =
regularizers_1.serializeRegularizer(this.depthwiseRegularizer);
config['depthwiseConstraint'] =
constraints_1.serializeConstraint(this.depthwiseRegularizer);
return config;
};
DepthwiseConv2D.className = 'DepthwiseConv2D';

@@ -118,0 +129,0 @@ return DepthwiseConv2D;

@@ -51,2 +51,3 @@ import { serialization, Tensor } from '@tensorflow/tfjs-core';

protected static verifyConfig(config: BaseConvLayerConfig): void;
getConfig(): serialization.ConfigDict;
}

@@ -53,0 +54,0 @@ export declare abstract class Conv extends BaseConv {

@@ -179,2 +179,20 @@ "use strict";

};
BaseConv.prototype.getConfig = function () {
var config = {
kernelSize: this.kernelSize,
strides: this.strides,
padding: this.padding,
dataFormat: this.dataFormat,
dilationRate: this.dilationRate,
activation: activations_1.serializeActivation(this.activation),
useBias: this.useBias,
biasInitializer: initializers_1.serializeInitializer(this.biasInitializer),
biasRegularizer: regularizers_1.serializeRegularizer(this.biasRegularizer),
activityRegularizer: regularizers_1.serializeRegularizer(this.activityRegularizer),
biasConstraint: constraints_1.serializeConstraint(this.biasConstraint)
};
var baseConfig = _super.prototype.getConfig.call(this);
Object.assign(config, baseConfig);
return config;
};
return BaseConv;

@@ -257,18 +275,6 @@ }(topology_1.Layer));

var config = {
rank: this.rank,
filters: this.filters,
kernelSize: this.kernelSize,
strides: this.strides,
padding: this.padding,
dataFormat: this.dataFormat,
dilationRate: this.dilationRate,
activation: activations_1.serializeActivation(this.activation),
useBias: this.useBias,
kernelInitializer: initializers_1.serializeInitializer(this.kernelInitializer),
biasInitializer: initializers_1.serializeInitializer(this.biasInitializer),
kernelRegularizer: regularizers_1.serializeRegularizer(this.kernelRegularizer),
biasRegularizer: regularizers_1.serializeRegularizer(this.biasRegularizer),
activityRegularizer: regularizers_1.serializeRegularizer(this.activityRegularizer),
kernelConstraint: constraints_1.serializeConstraint(this.kernelConstraint),
biasConstraint: constraints_1.serializeConstraint(this.biasConstraint)
kernelConstraint: constraints_1.serializeConstraint(this.kernelConstraint)
};

@@ -645,5 +651,5 @@ var baseConfig = _super.prototype.getConfig.call(this);

_this.inputSpec = [{ ndim: 4 }];
_this.size = config.size === undefined ? _this.DEFAULT_SIZE : config.size;
_this.size = config.size == null ? _this.DEFAULT_SIZE : config.size;
_this.dataFormat =
config.dataFormat === undefined ? 'channelsLast' : config.dataFormat;
config.dataFormat == null ? 'channelsLast' : config.dataFormat;
return _this;

@@ -653,9 +659,9 @@ }

if (this.dataFormat === 'channelsFirst') {
var height = this.size[0] * inputShape[2];
var width = this.size[1] * inputShape[3];
var height = inputShape[2] == null ? null : this.size[0] * inputShape[2];
var width = inputShape[3] == null ? null : this.size[1] * inputShape[3];
return [inputShape[0], inputShape[1], height, width];
}
else {
var height = this.size[0] * inputShape[1];
var width = this.size[1] * inputShape[2];
var height = inputShape[1] == null ? null : this.size[0] * inputShape[1];
var width = inputShape[2] == null ? null : this.size[1] * inputShape[2];
return [inputShape[0], height, width, inputShape[3]];

@@ -662,0 +668,0 @@ }

@@ -30,2 +30,3 @@ import { serialization, Tensor } from '@tensorflow/tfjs-core';

build(inputShape: Shape | Shape[]): void;
protected warnOnIncompatibleInputShape(inputShape: Shape): void;
computeMask(inputs: Tensor | Tensor[], mask?: Tensor | Tensor[]): Tensor;

@@ -32,0 +33,0 @@ computeOutputShape(inputShape: Shape | Shape[]): Shape | Shape[];

@@ -55,2 +55,3 @@ "use strict";

};
Embedding.prototype.warnOnIncompatibleInputShape = function (inputShape) { };
Embedding.prototype.computeMask = function (inputs, mask) {

@@ -57,0 +58,0 @@ throw new errors_1.NotImplementedError('computeMask has not been implemented for Embedding yet');

@@ -11,2 +11,7 @@ import * as tfc from '@tensorflow/tfjs-core';

import { LayerVariable } from '../variables';
export declare function standardizeArgs(inputs: Tensor | Tensor[] | SymbolicTensor | SymbolicTensor[], initialState: Tensor | Tensor[] | SymbolicTensor | SymbolicTensor[], constants: Tensor | Tensor[] | SymbolicTensor | SymbolicTensor[], numConstants?: number): {
inputs: Tensor | SymbolicTensor;
initialState: Tensor[] | SymbolicTensor[];
constants: Tensor[] | SymbolicTensor[];
};
export declare function rnn(stepFunction: RnnStepFunction, inputs: Tensor, initialStates: Tensor[], goBackwards?: boolean, mask?: Tensor, constants?: Tensor[], unroll?: boolean, inputLength?: number): [Tensor, Tensor, Tensor[]];

@@ -43,7 +48,2 @@ export interface BaseRNNLayerConfig extends LayerConfig {

resetStates(states?: Tensor | Tensor[]): void;
protected standardizeArgs(inputs: Tensor | Tensor[] | SymbolicTensor | SymbolicTensor[], initialState: Tensor | Tensor[] | SymbolicTensor | SymbolicTensor[], constants: Tensor | Tensor[] | SymbolicTensor | SymbolicTensor[]): {
inputs: Tensor | SymbolicTensor;
initialState: Tensor[] | SymbolicTensor[];
constants: Tensor[] | SymbolicTensor[];
};
apply(inputs: Tensor | Tensor[] | SymbolicTensor | SymbolicTensor[], kwargs?: Kwargs): Tensor | Tensor[] | SymbolicTensor | SymbolicTensor[];

@@ -58,2 +58,4 @@ call(inputs: Tensor | Tensor[], kwargs: Kwargs): Tensor | Tensor[];

stateSize: number | number[];
dropoutMask: Tensor | Tensor[];
recurrentDropoutMask: Tensor | Tensor[];
}

@@ -60,0 +62,0 @@ export interface SimpleRNNCellLayerConfig extends LayerConfig {

@@ -46,2 +46,3 @@ import * as tfc from '@tensorflow/tfjs-core';

private returnState;
private numConstants?;
private _trainable;

@@ -48,0 +49,0 @@ constructor(config: BidirectionalLayerConfig);

@@ -15,6 +15,6 @@ "use strict";

var tfjs_core_1 = require("@tensorflow/tfjs-core");
var state_1 = require("../backend/state");
var K = require("../backend/tfjs_backend");
var common_1 = require("../common");
var topology_1 = require("../engine/topology");
var state_1 = require("../backend/state");
var errors_1 = require("../errors");

@@ -184,2 +184,3 @@ var generic_utils = require("../utils/generic_utils");

_this.inputSpec = config.layer.inputSpec;
_this.numConstants = null;
return _this;

@@ -248,6 +249,11 @@ }

Bidirectional.prototype.apply = function (inputs, kwargs) {
var initialState = null;
if (kwargs != null) {
initialState = kwargs['initialState'];
var initialState = kwargs == null ? null : kwargs['initialState'];
var constants = kwargs == null ? null : kwargs['constants'];
if (kwargs == null) {
kwargs = {};
}
var standardized = recurrent_1.standardizeArgs(inputs, initialState, constants, this.numConstants);
inputs = standardized.inputs;
initialState = standardized.initialState;
constants = standardized.constants;
if (Array.isArray(inputs)) {

@@ -257,9 +263,46 @@ initialState = inputs.slice(1);

}
if (initialState == null || initialState.length === 0) {
var applyOutputs = _super.prototype.apply.call(this, inputs, kwargs);
return applyOutputs;
if ((initialState == null || initialState.length === 0) &&
constants == null) {
return _super.prototype.apply.call(this, inputs, kwargs);
}
var additionalInputs = [];
var additionalSpecs = [];
if (initialState != null) {
var numStates = initialState.length;
if (numStates % 2 > 0) {
throw new errors_1.ValueError('When passing `initialState` to a Bidrectional RNN, ' +
'the state should be an Array containing the states of ' +
'the underlying RNNs.');
}
kwargs['initialState'] = initialState;
additionalInputs.push.apply(additionalInputs, initialState);
var stateSpecs = initialState
.map(function (state) { return new topology_1.InputSpec({ shape: state.shape }); });
this.forwardLayer.stateSpec = stateSpecs.slice(0, numStates / 2);
this.backwardLayer.stateSpec = stateSpecs.slice(numStates / 2);
additionalSpecs.push.apply(additionalSpecs, stateSpecs);
}
if (constants != null) {
throw new errors_1.NotImplementedError('Support for constants in Bidirectional layers is not ' +
'implemented yet.');
}
var isSymbolicTensor = additionalInputs[0] instanceof topology_1.SymbolicTensor;
for (var _i = 0, additionalInputs_1 = additionalInputs; _i < additionalInputs_1.length; _i++) {
var tensor = additionalInputs_1[_i];
if (tensor instanceof topology_1.SymbolicTensor !== isSymbolicTensor) {
throw new errors_1.ValueError('The initial state of a Bidirectional layer cannot be ' +
'specified as a mix of symbolic and non-symbolic tensors');
}
}
if (isSymbolicTensor) {
var fullInput = [inputs].concat(additionalInputs);
var fullInputSpec = this.inputSpec.concat(additionalSpecs);
var originalInputSpec = this.inputSpec;
this.inputSpec = fullInputSpec;
var output = _super.prototype.apply.call(this, fullInput, kwargs);
this.inputSpec = originalInputSpec;
return output;
}
else {
throw new errors_1.NotImplementedError('The support for initial states is not implemented for ' +
'Bidirectional layers yet.');
return _super.prototype.apply.call(this, inputs, kwargs);
}

@@ -274,8 +317,15 @@ };

}
if (kwargs['initialState'] != null) {
throw new errors_1.NotImplementedError('The support for initial states is not implemented for ' +
'Bidirectional layers yet.');
var initialState = kwargs['initialState'];
var y;
var yRev;
if (initialState == null) {
y = _this.forwardLayer.call(inputs, kwargs);
yRev = _this.backwardLayer.call(inputs, kwargs);
}
var y = _this.forwardLayer.call(inputs, kwargs);
var yRev = _this.backwardLayer.call(inputs, kwargs);
else {
var forwardState = initialState.slice(0, initialState.length / 2);
var backwardState = initialState.slice(initialState.length / 2);
y = _this.forwardLayer.call(inputs, Object.assign(kwargs, { initialState: forwardState }));
yRev = _this.forwardLayer.call(inputs, Object.assign(kwargs, { initialState: backwardState }));
}
var states;

@@ -282,0 +332,0 @@ if (_this.returnState) {

@@ -12,8 +12,2 @@ "use strict";

})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -57,2 +51,3 @@ return new (P || (P = Promise))(function (resolve, reject) {

var state_1 = require("./backend/state");
var input_layer_1 = require("./engine/input_layer");
var topology_1 = require("./engine/topology");

@@ -167,5 +162,4 @@ var training_1 = require("./engine/training");

}
Sequential_1 = Sequential;
Sequential.prototype.add = function (layer) {
var isLayerModelInstance = layer instanceof Sequential_1 || layer instanceof training_1.Model;
var isLayerModelInstance = layer instanceof Sequential || layer instanceof training_1.Model;
var modelLayer;

@@ -193,3 +187,3 @@ if (isLayerModelInstance) {

}
var x = topology_1.Input({
var x = input_layer_1.Input({
batchShape: layer.batchInputShape,

@@ -375,3 +369,3 @@ dtype: layer.dtype,

var model = new cls({});
if (!(model instanceof Sequential_1)) {
if (!(model instanceof Sequential)) {
throw new errors_1.ValueError("Sequential.fromConfig called on non-Sequential input: " + model);

@@ -404,22 +398,3 @@ }

Sequential.className = 'Sequential';
__decorate([
tfjs_core_1.doc({ heading: 'Models', subheading: 'Classes' })
], Sequential.prototype, "add", null);
__decorate([
tfjs_core_1.doc({ heading: 'Models', subheading: 'Classes' })
], Sequential.prototype, "summary", null);
__decorate([
tfjs_core_1.doc({ heading: 'Models', subheading: 'Classes', configParamIndices: [2] })
], Sequential.prototype, "evaluate", null);
__decorate([
tfjs_core_1.doc({ heading: 'Models', subheading: 'Classes', configParamIndices: [1] })
], Sequential.prototype, "predict", null);
__decorate([
tfjs_core_1.doc({ heading: 'Models', subheading: 'Classes', configParamIndices: [2] })
], Sequential.prototype, "fit", null);
Sequential = Sequential_1 = __decorate([
tfjs_core_1.doc({ heading: 'Models', subheading: 'Classes' })
], Sequential);
return Sequential;
var Sequential_1;
}(training_1.Model));

@@ -426,0 +401,0 @@ exports.Sequential = Sequential;

@@ -12,13 +12,7 @@ "use strict";

})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var tfc = require("@tensorflow/tfjs-core");
var tfjs_core_1 = require("@tensorflow/tfjs-core");
var state_1 = require("./backend/state");
var K = require("./backend/tfjs_backend");
var state_1 = require("./backend/state");
var generic_utils_1 = require("./utils/generic_utils");

@@ -66,5 +60,2 @@ var Regularizer = (function (_super) {

L1L2.className = 'L1L2';
L1L2 = __decorate([
tfjs_core_1.doc({ heading: 'Regularizers', namespace: 'regularizers' })
], L1L2);
return L1L2;

@@ -71,0 +62,0 @@ }(Regularizer));

@@ -1,2 +0,2 @@

import { Container } from '../engine/topology';
import { Container } from '../engine/container';
export declare function printSummary(model: Container, lineLength?: number, positions?: number[], printFn?: (message?: any, ...optionalParams: any[]) => void): void;

@@ -1,2 +0,2 @@

declare const version = "0.7.0";
declare const version = "0.7.1";
export { version };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var version = '0.7.0';
var version = '0.7.1';
exports.version = version;
//# sourceMappingURL=version.js.map
{
"name": "@tensorflow/tfjs-layers",
"version": "0.7.0",
"version": "0.7.1",
"description": "TensorFlow layers API in JavaScript",

@@ -13,3 +13,3 @@ "private": false,

"devDependencies": {
"@tensorflow/tfjs-core": "~0.12.0",
"@tensorflow/tfjs-core": "~0.12.4",
"@types/jasmine": "~2.5.53",

@@ -49,4 +49,4 @@ "clang-format": "~1.2.2",

"peerDependencies": {
"@tensorflow/tfjs-core": "~0.12.0"
"@tensorflow/tfjs-core": "~0.12.4"
}
}

@@ -20,6 +20,5 @@ {

"noFallthroughCasesInSwitch": true,
"allowUnreachableCode": false,
"experimentalDecorators": true
"allowUnreachableCode": false
},
"include": ["src/"]
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc