Revert "Add Back tfjs Source Files"

This reverts commit 8ca90466e4.
This commit is contained in:
B Harrell committed 2021-05-25 11:05:23 -05:00
1 parent 42276e9c65
commit a08860d9fc
5000 files changed
+1 -686529

No files matched your search

+1 -1
View File
@@ -8,6 +8,6 @@ Projects/Superalgos/Icons/Thumbs.db
*.bat
!launch-windows.bat
!create-shortcut-windows.bat
!uninstall-shortcut-windows.bat
*.exe
node_modules
!Projects/TensorFlow/TS/Bot-Modules/Learning-Bot/Low-Frequency-Learning/node_modules
@@ -1 +0,0 @@
../detect-libc/bin/detect-libc.js
@@ -1 +0,0 @@
../mkdirp/bin/cmd.js
@@ -1 +0,0 @@
../needle/bin/needle
@@ -1 +0,0 @@
../node-pre-gyp/bin/node-pre-gyp
@@ -1 +0,0 @@
../nopt/bin/nopt.js
@@ -1 +0,0 @@
../nugget/bin.js
@@ -1 +0,0 @@
../pretty-bytes/cli.js
@@ -1 +0,0 @@
../rc/cli.js
@@ -1 +0,0 @@
../rimraf/bin.js
@@ -1 +0,0 @@
../semver/bin/semver
@@ -1 +0,0 @@
../sshpk/bin/sshpk-conv
@@ -1 +0,0 @@
../sshpk/bin/sshpk-sign
@@ -1 +0,0 @@
../sshpk/bin/sshpk-verify
@@ -1 +0,0 @@
../strip-indent/cli.js
@@ -1 +0,0 @@
../@tensorflow/tfjs/dist/tools/custom_module/cli.js
@@ -1 +0,0 @@
../uuid/bin/uuid
@@ -1,37 +0,0 @@
# Usage
This package implements a JavaScript based CPU backend to TensorFlow.js.
## Importing the backend
Note: this backend is included by default in `@tensorflow/tfjs`.
### Via NPM
```js
// Import @tensorflow/tfjs-core
import * as tf from '@tensorflow/tfjs-core';
// Adds the CPU backend to the global backend registry.
import '@tensorflow/tfjs-backend-cpu';
```
### Via a script tag
```html
<!-- Import @tensorflow/tfjs-core -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-core"></script>
<!-- Adds the CPU backend to the global backend registry -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-cpu"></script>
```
You can also get ES2017 code using the following links
```html
<!-- Import @tensorflow/tfjs-core -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-core@2.0.0-rc.4/dist/tf-core.es2017.js"></script>
<!-- Adds the CPU backend to the global backend registry -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-cpu@2.0.0-rc.4/dist/tf-backend-cpu.es2017.js"></script>
```
@@ -1,65 +0,0 @@
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { backend_util, BackendTimingInfo, DataStorage, DataType, KernelBackend, Rank, Tensor, Tensor2D, TensorBuffer, TensorInfo } from '@tensorflow/tfjs-core';
interface DataId {
}
export interface TensorData<D extends DataType> {
values?: backend_util.BackendValues;
dtype: D;
complexTensorInfos?: {
real: TensorInfo;
imag: TensorInfo;
};
refCount: number;
}
export declare class MathBackendCPU extends KernelBackend {
blockSize: number;
data: DataStorage<TensorData<DataType>>;
private firstUse;
constructor();
write(values: backend_util.BackendValues, shape: number[], dtype: DataType): DataId;
/**
* Create a data bucket in cpu backend.
* @param shape Shape of the `TensorInfo`.
* @param dtype DType of the `TensorInfo`.
* @param values The value of the `TensorInfo` stored as a flattened array.
*/
makeTensorInfo(shape: number[], dtype: DataType, values?: backend_util.BackendValues | string[]): TensorInfo;
/** Increase refCount of a `TensorData`. */
incRef(dataId: DataId): void;
/** Decrease refCount of a `TensorData`. */
decRef(dataId: DataId): void;
move(dataId: DataId, values: backend_util.BackendValues, shape: number[], dtype: DataType): void;
numDataIds(): number;
read(dataId: DataId): Promise<backend_util.BackendValues>;
readSync(dataId: DataId): backend_util.BackendValues;
bufferSync<R extends Rank>(t: TensorInfo): TensorBuffer<R>;
makeOutput<T extends Tensor>(values: backend_util.BackendValues, shape: number[], dtype: DataType): T;
disposeData(dataId: DataId): void;
disposeIntermediateTensorInfo(tensorInfo: TensorInfo): void;
time(f: () => void): Promise<BackendTimingInfo>;
memory(): {
unreliable: boolean;
reasons: string[];
};
where(condition: Tensor): Tensor2D;
dispose(): void;
floatPrecision(): 16 | 32;
/** Returns the smallest representable number. */
epsilon(): number;
}
export {};
@@ -1,161 +0,0 @@
/**
* @license
* Copyright 2017 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { backend_util, buffer, DataStorage, engine, env, kernel_impls, KernelBackend, util } from '@tensorflow/tfjs-core';
const whereImpl = kernel_impls.whereImpl;
import { assertNotComplex } from './cpu_util';
export class MathBackendCPU extends KernelBackend {
constructor() {
super();
this.blockSize = 48;
this.firstUse = true;
this.data = new DataStorage(this, engine());
}
write(values, shape, dtype) {
if (this.firstUse) {
this.firstUse = false;
if (env().get('IS_NODE')) {
backend_util.warn('\n============================\n' +
'Hi there 👋. Looks like you are running TensorFlow.js in ' +
'Node.js. To speed things up dramatically, install our node ' +
'backend, which binds to TensorFlow C++, by running ' +
'npm i @tensorflow/tfjs-node, ' +
'or npm i @tensorflow/tfjs-node-gpu if you have CUDA. ' +
'Then call require(\'@tensorflow/tfjs-node\'); (-gpu ' +
'suffix for CUDA) at the start of your program. ' +
'Visit https://github.com/tensorflow/tfjs-node for more details.' +
'\n============================');
}
}
const dataId = {};
this.data.set(dataId, { values, dtype, refCount: 1 });
return dataId;
}
/**
* Create a data bucket in cpu backend.
* @param shape Shape of the `TensorInfo`.
* @param dtype DType of the `TensorInfo`.
* @param values The value of the `TensorInfo` stored as a flattened array.
*/
makeTensorInfo(shape, dtype, values) {
let outId;
if (dtype === 'string' && values != null && values.length > 0 &&
util.isString(values[0])) {
const encodedValues = values.map(d => util.encodeString(d));
outId = this.write(encodedValues, shape, dtype);
}
else {
outId = this.write(values, shape, dtype);
}
return { dataId: outId, shape, dtype };
}
/** Increase refCount of a `TensorData`. */
incRef(dataId) {
const tensorData = this.data.get(dataId);
tensorData.refCount++;
}
/** Decrease refCount of a `TensorData`. */
decRef(dataId) {
if (this.data.has(dataId)) {
const tensorData = this.data.get(dataId);
tensorData.refCount--;
}
}
move(dataId, values, shape, dtype) {
this.data.set(dataId, { values, dtype, refCount: 1 });
}
numDataIds() {
return this.data.numDataIds();
}
async read(dataId) {
return this.readSync(dataId);
}
readSync(dataId) {
const { dtype, complexTensorInfos } = this.data.get(dataId);
if (dtype === 'complex64') {
const realValues = this.readSync(complexTensorInfos.real.dataId);
const imagValues = this.readSync(complexTensorInfos.imag.dataId);
return backend_util.mergeRealAndImagArrays(realValues, imagValues);
}
return this.data.get(dataId).values;
}
bufferSync(t) {
const data = this.readSync(t.dataId);
let decodedData = data;
if (t.dtype === 'string') {
try {
// Decode the bytes into string.
decodedData = data.map(d => util.decodeString(d));
}
catch (_a) {
throw new Error('Failed to decode encoded string bytes into utf-8');
}
}
return buffer(t.shape, t.dtype, decodedData);
}
makeOutput(values, shape, dtype) {
const dataId = this.write(values, shape, dtype);
return engine().makeTensorFromDataId(dataId, shape, dtype, this);
}
disposeData(dataId) {
if (this.data.has(dataId)) {
const { complexTensorInfos } = this.data.get(dataId);
if (complexTensorInfos != null) {
this.disposeData(complexTensorInfos.real.dataId);
this.disposeData(complexTensorInfos.imag.dataId);
}
this.data.delete(dataId);
}
}
disposeIntermediateTensorInfo(tensorInfo) {
const dataId = tensorInfo.dataId;
if (this.data.has(dataId)) {
const tensorData = this.data.get(dataId);
tensorData.refCount--;
if (tensorData.refCount < 1) {
this.disposeData(dataId);
}
}
}
async time(f) {
const start = util.now();
f();
const kernelMs = util.now() - start;
return { kernelMs };
}
memory() {
return {
// Unreliable due to automatic gc. The numbers above are cumulative.
unreliable: true,
reasons: ['The reported memory is an upper bound. Due to automatic garbage ' +
'collection, the true allocated memory may be less.']
};
}
where(condition) {
assertNotComplex([condition], 'where');
const condVals = this.readSync(condition.dataId);
return whereImpl(condition.shape, condVals);
}
dispose() { }
floatPrecision() {
return 32;
}
/** Returns the smallest representable number. */
epsilon() {
return super.epsilon();
}
}
//# sourceMappingURL=backend_cpu.js.map
@@ -1 +0,0 @@
{"version":3,"file":"backend_cpu.js","sourceRoot":"","sources":["../src/backend_cpu.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,YAAY,EAAqB,MAAM,EAAE,WAAW,EAAwB,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,aAAa,EAA0E,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAEzO,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC;AACzC,OAAO,EAAC,gBAAgB,EAAC,MAAM,YAAY,CAAC;AAgB5C,MAAM,OAAO,cAAe,SAAQ,aAAa;IAM/C;QACE,KAAK,EAAE,CAAC;QANH,cAAS,GAAG,EAAE,CAAC;QAGd,aAAQ,GAAG,IAAI,CAAC;QAItB,IAAI,CAAC,IAAI,GAAG,IAAI,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,MAAkC,EAAE,KAAe,EAAE,KAAe;QAExE,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YACtB,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;gBACxB,YAAY,CAAC,IAAI,CACb,kCAAkC;oBAClC,2DAA2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C;IAC9D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACb,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAEf,MAAM,GAAG,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;QACxB,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACnC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7B,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAElC,MAAM,gBAAgB,GAClB,kEAAkE;YAClE,oDAAoD,CAAC;QACzD,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QALine truncated
@@ -1,20 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import * as shared from './shared';
export { MathBackendCPU } from './backend_cpu';
export { version as version_cpu } from './version';
export { shared };
@@ -1,29 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
/*
* base.ts contains all the exports from tfjs-backend-cpu
* without auto-kernel registration
*/
import { registerBackend } from '@tensorflow/tfjs-core';
import { MathBackendCPU } from './backend_cpu';
import * as shared from './shared';
export { MathBackendCPU } from './backend_cpu';
export { version as version_cpu } from './version';
export { shared };
// Side effects for default initialization of MathBackendCPU
registerBackend('cpu', () => new MathBackendCPU(), 1 /* priority */);
//# sourceMappingURL=base.js.map
@@ -1 +0,0 @@
{"version":3,"file":"base.js","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;GAGG;AACH,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,WAAW,CAAC;AACjD,OAAO,EAAC,MAAM,EAAC,CAAC;AAEhB,4DAA4D;AAC5D,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,cAAc,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC"}
@@ -1,18 +0,0 @@
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { TensorInfo } from '@tensorflow/tfjs-core';
export declare function assertNotComplex(tensor: TensorInfo | TensorInfo[], opName: string): void;
@@ -1,28 +0,0 @@
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { util } from '@tensorflow/tfjs-core';
export function assertNotComplex(tensor, opName) {
if (!Array.isArray(tensor)) {
tensor = [tensor];
}
tensor.forEach(t => {
if (t != null) {
util.assert(t.dtype !== 'complex64', () => `${opName} does not support complex64 tensors in the CPU backend.`);
}
});
}
//# sourceMappingURL=cpu_util.js.map
@@ -1 +0,0 @@
{"version":3,"file":"cpu_util.js","sourceRoot":"","sources":["../src/cpu_util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAa,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAEvD,MAAM,UAAU,gBAAgB,CAC5B,MAA+B,EAAE,MAAc;IACjD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QAC1B,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC;KACnB;IACD,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QACjB,IAAI,CAAC,IAAI,IAAI,EAAE;YACb,IAAI,CAAC,MAAM,CACP,CAAC,CAAC,KAAK,KAAK,WAAW,EACvB,GAAG,EAAE,CAAC,GACF,MAAM,yDAAyD,CAAC,CAAC;SAC1E;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,18 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
export * from './base';
import './register_all_kernels';
@@ -1,20 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
// All exports from this package should be in base.
export * from './base';
import './register_all_kernels';
//# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,mDAAmD;AACnD,cAAc,QAAQ,CAAC;AACvB,OAAO,wBAAwB,CAAC"}
@@ -1,24 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { KernelConfig, TypedArray } from '@tensorflow/tfjs-core';
import { MathBackendCPU } from '../backend_cpu';
export declare function simpleAbsImpl(vals: TypedArray): Float32Array;
export declare const abs: (args: {
inputs: Pick<import("@tensorflow/tfjs-core").NamedTensorInfoMap, "x">;
backend: MathBackendCPU;
}) => import("@tensorflow/tfjs-core").Tensor<import("@tensorflow/tfjs-core").Rank>;
export declare const absConfig: KernelConfig;
@@ -1,40 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { Abs, util } from '@tensorflow/tfjs-core';
import { assertNotComplex } from '../cpu_util';
export function simpleAbsImpl(vals) {
const resultValues = new Float32Array(vals.length);
for (let i = 0; i < vals.length; ++i) {
resultValues[i] = Math.abs(vals[i]);
}
return resultValues;
}
export const abs = (args) => {
const { x } = args.inputs;
const cpuBackend = args.backend;
assertNotComplex(x, 'abs');
let resultValues = new Float32Array(util.sizeFromShape(x.shape));
const values = cpuBackend.data.get(x.dataId).values;
resultValues = simpleAbsImpl(values);
return cpuBackend.makeOutput(resultValues, x.shape, 'float32');
};
export const absConfig = {
kernelName: Abs,
backendName: 'cpu',
kernelFunc: abs,
};
//# sourceMappingURL=Abs.js.map
@@ -1 +0,0 @@
{"version":3,"file":"Abs.js","sourceRoot":"","sources":["../../src/kernels/Abs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,GAAG,EAAmD,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAGjG,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAE7C,MAAM,UAAU,aAAa,CAAC,IAAgB;IAC5C,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;QACpC,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;KACrC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,IAAkD,EAAE,EAAE;IACxE,MAAM,EAAC,CAAC,EAAC,GAAG,IAAI,CAAC,MAAM,CAAC;IACxB,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC;IAEhC,gBAAgB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAE3B,IAAI,YAAY,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACjE,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAoB,CAAC;IAClE,YAAY,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IAErC,OAAO,UAAU,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACjE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAiB;IACrC,UAAU,EAAE,GAAG;IACf,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,GAAuB;CACpC,CAAC"}
@@ -1,19 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { KernelConfig } from '@tensorflow/tfjs-core';
export declare const acos: import("@tensorflow/tfjs-core").KernelFunc;
export declare const acosConfig: KernelConfig;
@@ -1,25 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { Acos } from '@tensorflow/tfjs-core';
import { unaryKernelFunc } from '../utils/unary_utils';
export const acos = unaryKernelFunc(Acos, (xi) => Math.acos(xi));
export const acosConfig = {
kernelName: Acos,
backendName: 'cpu',
kernelFunc: acos,
};
//# sourceMappingURL=Acos.js.map
@@ -1 +0,0 @@
{"version":3,"file":"Acos.js","sourceRoot":"","sources":["../../src/kernels/Acos.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,IAAI,EAAe,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAEjE,MAAM,CAAC,MAAM,UAAU,GAAiB;IACtC,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,IAAI;CACjB,CAAC"}
@@ -1,19 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { KernelConfig } from '@tensorflow/tfjs-core';
export declare const acosh: import("@tensorflow/tfjs-core").KernelFunc;
export declare const acoshConfig: KernelConfig;
@@ -1,25 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { Acosh } from '@tensorflow/tfjs-core';
import { unaryKernelFunc } from '../utils/unary_utils';
export const acosh = unaryKernelFunc(Acosh, (xi) => Math.acosh(xi));
export const acoshConfig = {
kernelName: Acosh,
backendName: 'cpu',
kernelFunc: acosh,
};
//# sourceMappingURL=Acosh.js.map
@@ -1 +0,0 @@
{"version":3,"file":"Acosh.js","sourceRoot":"","sources":["../../src/kernels/Acosh.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,KAAK,EAAe,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,MAAM,CAAC,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,WAAW,GAAiB;IACvC,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,KAAK;CAClB,CAAC"}
@@ -1,21 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { KernelConfig } from '@tensorflow/tfjs-core';
export declare const addImpl: import("../shared").SimpleBinaryKernelImpl;
export declare const addComplexImpl: import("../shared").ComplexBinaryKernelImpl;
export declare const add: import("@tensorflow/tfjs-core").KernelFunc;
export declare const addConfig: KernelConfig;
@@ -1,30 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { Add } from '@tensorflow/tfjs-core';
import { createSimpleBinaryKernelImpl } from '../utils/binary_impl';
import { binaryKernelFunc, createComplexBinaryKernelImpl } from '../utils/binary_utils';
export const addImpl = createSimpleBinaryKernelImpl(((a, b) => a + b));
export const addComplexImpl = createComplexBinaryKernelImpl(((aReal, aImag, bReal, bImag) => {
return { real: aReal + bReal, imag: aImag + bImag };
}));
export const add = binaryKernelFunc(Add, addImpl, addComplexImpl);
export const addConfig = {
kernelName: Add,
backendName: 'cpu',
kernelFunc: add
};
//# sourceMappingURL=Add.js.map
@@ -1 +0,0 @@
{"version":3,"file":"Add.js","sourceRoot":"","sources":["../../src/kernels/Add.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,GAAG,EAAe,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAC,4BAA4B,EAAC,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAC,gBAAgB,EAAE,6BAA6B,EAAC,MAAM,uBAAuB,CAAC;AAEtF,MAAM,CAAC,MAAM,OAAO,GAAG,4BAA4B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,cAAc,GACvB,6BAA6B,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;IAC5D,OAAO,EAAC,IAAI,EAAE,KAAK,GAAG,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,KAAK,EAAC,CAAC;AACpD,CAAC,CAAC,CAAC,CAAC;AAER,MAAM,CAAC,MAAM,GAAG,GAAG,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;AAElE,MAAM,CAAC,MAAM,SAAS,GAAiB;IACrC,UAAU,EAAE,GAAG;IACf,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,GAAG;CAChB,CAAC"}
@@ -1,23 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { AddNInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
import { MathBackendCPU } from '../backend_cpu';
export declare function addN(args: {
inputs: AddNInputs;
backend: MathBackendCPU;
}): TensorInfo;
export declare const addNConfig: KernelConfig;
@@ -1,39 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { AddN, buffer } from '@tensorflow/tfjs-core';
import { assertNotComplex } from '../cpu_util';
export function addN(args) {
const { inputs, backend } = args;
const tensors = inputs;
assertNotComplex(inputs, 'addN');
const vals = tensors.map(t => backend.data.get(t.dataId).values);
const outBuf = buffer(tensors[0].shape, tensors[0].dtype);
const outVals = outBuf.values;
for (let i = 0; i < tensors.length; i++) {
const currVals = vals[i];
for (let j = 0; j < outVals.length; j++) {
outVals[j] += currVals[j];
}
}
return backend.makeTensorInfo(outBuf.shape, outBuf.dtype, outBuf.values);
}
export const addNConfig = {
kernelName: AddN,
backendName: 'cpu',
kernelFunc: addN
};
//# sourceMappingURL=AddN.js.map
@@ -1 +0,0 @@
{"version":3,"file":"AddN.js","sourceRoot":"","sources":["../../src/kernels/AddN.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,IAAI,EAAc,MAAM,EAA2D,MAAM,uBAAuB,CAAC;AAGzH,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAE7C,MAAM,UAAU,IAAI,CAAC,IAAmD;IAEtE,MAAM,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC;IAC/B,MAAM,OAAO,GAAG,MAAkB,CAAC;IAEnC,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC,MAAM,IAAI,GACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAoB,CAAC,CAAC;IACtE,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,KAAkB,CAAC,CAAC;IACvE,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACvC,OAAO,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC;SAC3B;KACF;IAED,OAAO,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;AAC3E,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAiB;IACtC,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,IAAwB;CACrC,CAAC"}
@@ -1,24 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { AllAttrs, AllInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
import { MathBackendCPU } from '../backend_cpu';
export declare function all(args: {
inputs: AllInputs;
backend: MathBackendCPU;
attrs: AllAttrs;
}): TensorInfo;
export declare const allConfig: KernelConfig;
@@ -1,65 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { All, backend_util, util } from '@tensorflow/tfjs-core';
import { assertNotComplex } from '../cpu_util';
import { reshape } from './Reshape';
import { transpose } from './Transpose';
export function all(args) {
const { inputs, backend, attrs } = args;
const { x } = inputs;
const { axis, keepDims } = attrs;
assertNotComplex(x, 'all');
const origAxes = util.parseAxisParam(axis, x.shape);
let axes = origAxes;
const permutedAxes = backend_util.getAxesPermutation(axes, x.shape.length);
let $x = x;
if (permutedAxes != null) {
$x = transpose({ inputs: { x }, backend, attrs: { perm: permutedAxes } });
axes = backend_util.getInnerMostAxes(axes.length, x.shape.length);
}
backend_util.assertAxesAreInnerMostDims('all', axes, $x.shape.length);
const [outShape, reduceShape] = backend_util.computeOutAndReduceShapes($x.shape, axes);
const reduceSize = util.sizeFromShape(reduceShape);
const vals = util.makeZerosTypedArray(util.sizeFromShape(outShape), $x.dtype);
const aVals = backend.data.get($x.dataId).values;
for (let i = 0; i < vals.length; ++i) {
const offset = i * reduceSize;
let all = aVals[offset];
for (let j = 0; j < reduceSize; ++j) {
const value = aVals[offset + j];
all = all && value;
}
vals[i] = all;
}
if (permutedAxes != null) {
backend.disposeIntermediateTensorInfo($x);
}
const result = backend.makeTensorInfo(outShape, $x.dtype, vals);
if (keepDims) {
const expandedShape = backend_util.expandShapeToKeepDim(outShape, origAxes);
const reshapedResult = reshape({ inputs: { x: result }, backend, attrs: { shape: expandedShape } });
backend.disposeIntermediateTensorInfo(result);
return reshapedResult;
}
return result;
}
export const allConfig = {
kernelName: All,
backendName: 'cpu',
kernelFunc: all
};
//# sourceMappingURL=All.js.map
@@ -1 +0,0 @@
{"version":3,"file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AAE,EAAC,CAAC,EAAE,MAAM,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAC,KAAK,EAAE,aAAa,EAAC,EAAC,CAAC,CAAC;QAE3E,OAAO,CAAC,6BAA6B,CAAC,MAAM,CAAC,CAAC;QAE9C,OAAO,cAAc,CAAC;KACvB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAiB;IACrC,UAAU,EAAE,GAAG;IACf,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,GAAuB;CACpC,CAAC"}
@@ -1,24 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { AnyAttrs, AnyInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
import { MathBackendCPU } from '../backend_cpu';
export declare function any(args: {
inputs: AnyInputs;
backend: MathBackendCPU;
attrs: AnyAttrs;
}): TensorInfo;
export declare const anyConfig: KernelConfig;
@@ -1,65 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { Any, backend_util, util } from '@tensorflow/tfjs-core';
import { assertNotComplex } from '../cpu_util';
import { reshape } from './Reshape';
import { transpose } from './Transpose';
export function any(args) {
const { inputs, backend, attrs } = args;
const { x } = inputs;
const { axis, keepDims } = attrs;
assertNotComplex(x, 'any');
const origAxes = util.parseAxisParam(axis, x.shape);
let axes = origAxes;
const permutedAxes = backend_util.getAxesPermutation(axes, x.shape.length);
let $x = x;
if (permutedAxes != null) {
$x = transpose({ inputs: { x }, backend, attrs: { perm: permutedAxes } });
axes = backend_util.getInnerMostAxes(axes.length, x.shape.length);
}
backend_util.assertAxesAreInnerMostDims('any', axes, $x.shape.length);
const [outShape, reduceShape] = backend_util.computeOutAndReduceShapes($x.shape, axes);
const reduceSize = util.sizeFromShape(reduceShape);
const vals = util.makeZerosTypedArray(util.sizeFromShape(outShape), $x.dtype);
const aVals = backend.data.get($x.dataId).values;
for (let i = 0; i < vals.length; ++i) {
const offset = i * reduceSize;
let anyVal = aVals[offset];
for (let j = 0; j < reduceSize; ++j) {
const value = aVals[offset + j];
anyVal = anyVal || value;
}
vals[i] = anyVal;
}
if (permutedAxes != null) {
backend.disposeIntermediateTensorInfo($x);
}
const result = backend.makeTensorInfo(outShape, $x.dtype, vals);
if (keepDims) {
const expandedShape = backend_util.expandShapeToKeepDim(outShape, origAxes);
const reshapedResult = reshape({ inputs: { x: result }, backend, attrs: { shape: expandedShape } });
backend.disposeIntermediateTensorInfo(result);
return reshapedResult;
}
return result;
}
export const anyConfig = {
kernelName: Any,
backendName: 'cpu',
kernelFunc: any
};
//# sourceMappingURL=Any.js.map
@@ -1 +0,0 @@
{"version":3,"file":"Any.js","sourceRoot":"","sources":["../../src/kernels/Any.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,GAAG,EAAuB,YAAY,EAAoD,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAGrI,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEt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AAK;IAClB,UAAU,EAAE,GAAuB;CACpC,CAAC"}
@@ -1,24 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { ArgMaxAttrs, ArgMaxInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
import { MathBackendCPU } from '../backend_cpu';
export declare function argMax(args: {
inputs: ArgMaxInputs;
backend: MathBackendCPU;
attrs: ArgMaxAttrs;
}): TensorInfo;
export declare const argMaxConfig: KernelConfig;
@@ -1,62 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { ArgMax, backend_util, util } from '@tensorflow/tfjs-core';
import { assertNotComplex } from '../cpu_util';
import { transpose } from './Transpose';
export function argMax(args) {
const { inputs, backend, attrs } = args;
const { x } = inputs;
const { axis } = attrs;
assertNotComplex(x, 'argMax');
let axes = util.parseAxisParam(axis, x.shape);
const permutedAxes = backend_util.getAxesPermutation(axes, x.shape.length);
let $x = x;
const intermediateTensorInfos = [];
if (permutedAxes != null) {
$x = transpose({ inputs: { x }, backend, attrs: { perm: permutedAxes } });
intermediateTensorInfos.push($x);
axes = backend_util.getInnerMostAxes(axes.length, $x.shape.length);
}
axes = [axes[0]];
backend_util.assertAxesAreInnerMostDims('argMax', axes, $x.shape.length);
const [outShape, reduceShape] = backend_util.computeOutAndReduceShapes($x.shape, axes);
const outSize = util.sizeFromShape(outShape);
const vals = util.makeZerosTypedArray(outSize, 'int32');
const reduceSize = util.sizeFromShape(reduceShape);
const aVals = backend.data.get($x.dataId).values;
for (let i = 0; i < vals.length; ++i) {
const offset = i * reduceSize;
let max = aVals[offset];
let maxIndex = 0;
for (let j = 0; j < reduceSize; ++j) {
const value = aVals[offset + j];
if (value > max) {
max = value;
maxIndex = j;
}
}
vals[i] = maxIndex;
}
intermediateTensorInfos.forEach(t => backend.disposeIntermediateTensorInfo(t));
return backend.makeTensorInfo(outShape, 'int32', vals);
}
export const argMaxConfig = {
kernelName: ArgMax,
backendName: 'cpu',
kernelFunc: argMax
};
//# sourceMappingURL=ArgMax.js.map
@@ -1 +0,0 @@
{"version":3,"file":"ArgMax.js","sourceRoot":"","sources":["../../src/kernels/ArgMax.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,MAAM,EAA6B,YAAY,EAAoD,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAG9I,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,MAAM,UAAU,MAAM,CAClB,IAAyE;IAE3E,MAAM,EAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC;IACtC,MAAM,EAAC,CAAC,EAAC,GAAG,MAAM,CAAC;IACnB,MAAM,EAAC,IAAI,EAAC,GAAG,KAAK,CAAC;IAErB,gBAAgB,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAE9B,IAAI,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,YAAY,GAAG,YAAY,CAAC,kBAAkB,CAAC,IAAI,EAA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AG,KAAK,CAAC,MAAM,CAAC,CAAC;QACxB,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,EAAE,CAAC,EAAE;YACnC,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAChC,IAAI,KAAK,GAAG,GAAG,EAAE;gBACf,GAAG,GAAG,KAAK,CAAC;gBACZ,QAAQ,GAAG,CAAC,CAAC;aACd;SACF;QACD,IAAI,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC;KACpB;IAED,uBAAuB,CAAC,OAAO,CAC3B,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC;IAEnD,OAAO,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAiB;IACxC,UAAU,EAAE,MAAM;IAClB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,MAA0B;CACvC,CAAC"}
@@ -1,24 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { ArgMinAttrs, ArgMinInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
import { MathBackendCPU } from '../backend_cpu';
export declare function argMin(args: {
inputs: ArgMinInputs;
backend: MathBackendCPU;
attrs: ArgMinAttrs;
}): TensorInfo;
export declare const argMinConfig: KernelConfig;
@@ -1,62 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { ArgMin, backend_util, util } from '@tensorflow/tfjs-core';
import { assertNotComplex } from '../cpu_util';
import { transpose } from './Transpose';
export function argMin(args) {
const { inputs, backend, attrs } = args;
const { x } = inputs;
const { axis } = attrs;
assertNotComplex(x, 'argMin');
let axes = util.parseAxisParam(axis, x.shape);
const permutedAxes = backend_util.getAxesPermutation(axes, x.shape.length);
let $x = x;
const intermediateTensorInfos = [];
if (permutedAxes != null) {
$x = transpose({ inputs: { x }, backend, attrs: { perm: permutedAxes } });
intermediateTensorInfos.push($x);
axes = backend_util.getInnerMostAxes(axes.length, $x.shape.length);
}
axes = [axes[0]];
backend_util.assertAxesAreInnerMostDims('argMin', axes, $x.shape.length);
const [outShape, reduceShape] = backend_util.computeOutAndReduceShapes($x.shape, axes);
const outSize = util.sizeFromShape(outShape);
const vals = util.makeZerosTypedArray(outSize, 'int32');
const reduceSize = util.sizeFromShape(reduceShape);
const aVals = backend.data.get($x.dataId).values;
for (let i = 0; i < vals.length; ++i) {
const offset = i * reduceSize;
let min = aVals[offset];
let minIndex = 0;
for (let j = 0; j < reduceSize; ++j) {
const value = aVals[offset + j];
if (value < min) {
min = value;
minIndex = j;
}
}
vals[i] = minIndex;
}
intermediateTensorInfos.forEach(t => backend.disposeIntermediateTensorInfo(t));
return backend.makeTensorInfo(outShape, 'int32', vals);
}
export const argMinConfig = {
kernelName: ArgMin,
backendName: 'cpu',
kernelFunc: argMin
};
//# sourceMappingURL=ArgMin.js.map
@@ -1 +0,0 @@
{"version":3,"file":"ArgMin.js","sourceRoot":"","sources":["../../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AC;AAED,MAAM,CAAC,MAAM,YAAY,GAAiB;IACxC,UAAU,EAAE,MAAM;IAClB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,MAA0B;CACvC,CAAC"}
@@ -1,19 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { KernelConfig } from '@tensorflow/tfjs-core';
export declare const asin: import("@tensorflow/tfjs-core").KernelFunc;
export declare const asinConfig: KernelConfig;
@@ -1,25 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { Asin } from '@tensorflow/tfjs-core';
import { unaryKernelFunc } from '../utils/unary_utils';
export const asin = unaryKernelFunc(Asin, (xi) => Math.asin(xi));
export const asinConfig = {
kernelName: Asin,
backendName: 'cpu',
kernelFunc: asin,
};
//# sourceMappingURL=Asin.js.map
@@ -1 +0,0 @@
{"version":3,"file":"Asin.js","sourceRoot":"","sources":["../../src/kernels/Asin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,IAAI,EAAe,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAEjE,MAAM,CAAC,MAAM,UAAU,GAAiB;IACtC,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,IAAI;CACjB,CAAC"}
@@ -1,19 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { KernelConfig } from '@tensorflow/tfjs-core';
export declare const asinh: import("@tensorflow/tfjs-core").KernelFunc;
export declare const asinhConfig: KernelConfig;
@@ -1,25 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { Asinh } from '@tensorflow/tfjs-core';
import { unaryKernelFunc } from '../utils/unary_utils';
export const asinh = unaryKernelFunc(Asinh, (xi) => Math.asinh(xi));
export const asinhConfig = {
kernelName: Asinh,
backendName: 'cpu',
kernelFunc: asinh,
};
//# sourceMappingURL=Asinh.js.map
@@ -1 +0,0 @@
{"version":3,"file":"Asinh.js","sourceRoot":"","sources":["../../src/kernels/Asinh.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,KAAK,EAAe,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,MAAM,CAAC,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,WAAW,GAAiB;IACvC,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,KAAK;CAClB,CAAC"}
@@ -1,19 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { KernelConfig } from '@tensorflow/tfjs-core';
export declare const atan: import("@tensorflow/tfjs-core").KernelFunc;
export declare const atanConfig: KernelConfig;
@@ -1,25 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { Atan } from '@tensorflow/tfjs-core';
import { unaryKernelFunc } from '../utils/unary_utils';
export const atan = unaryKernelFunc(Atan, (xi) => Math.atan(xi));
export const atanConfig = {
kernelName: Atan,
backendName: 'cpu',
kernelFunc: atan,
};
//# sourceMappingURL=Atan.js.map
@@ -1 +0,0 @@
{"version":3,"file":"Atan.js","sourceRoot":"","sources":["../../src/kernels/Atan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,IAAI,EAAe,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAEjE,MAAM,CAAC,MAAM,UAAU,GAAiB;IACtC,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,IAAI;CACjB,CAAC"}
@@ -1,20 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { KernelConfig } from '@tensorflow/tfjs-core';
export declare const atan2Impl: import("../shared").SimpleBinaryKernelImpl;
export declare const atan2: import("@tensorflow/tfjs-core").KernelFunc;
export declare const atan2Config: KernelConfig;
@@ -1,27 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { Atan2 } from '@tensorflow/tfjs-core';
import { createSimpleBinaryKernelImpl } from '../utils/binary_impl';
import { binaryKernelFunc } from '../utils/binary_utils';
export const atan2Impl = createSimpleBinaryKernelImpl((aValue, bValue) => Math.atan2(aValue, bValue));
export const atan2 = binaryKernelFunc(Atan2, atan2Impl);
export const atan2Config = {
kernelName: Atan2,
backendName: 'cpu',
kernelFunc: atan2,
};
//# sourceMappingURL=Atan2.js.map
@@ -1 +0,0 @@
{"version":3,"file":"Atan2.js","sourceRoot":"","sources":["../../src/kernels/Atan2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,KAAK,EAAe,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAC,4BAA4B,EAAC,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG,4BAA4B,CACjD,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEpD,MAAM,CAAC,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,WAAW,GAAiB;IACvC,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,KAAK;CAClB,CAAC"}
@@ -1,19 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { KernelConfig } from '@tensorflow/tfjs-core';
export declare const atanh: import("@tensorflow/tfjs-core").KernelFunc;
export declare const atanhConfig: KernelConfig;
@@ -1,25 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { Atanh } from '@tensorflow/tfjs-core';
import { unaryKernelFunc } from '../utils/unary_utils';
export const atanh = unaryKernelFunc(Atanh, (xi) => Math.atanh(xi));
export const atanhConfig = {
kernelName: Atanh,
backendName: 'cpu',
kernelFunc: atanh,
};
//# sourceMappingURL=Atanh.js.map
@@ -1 +0,0 @@
{"version":3,"file":"Atanh.js","sourceRoot":"","sources":["../../src/kernels/Atanh.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,KAAK,EAAe,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,MAAM,CAAC,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,WAAW,GAAiB;IACvC,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,KAAK;CAClB,CAAC"}
@@ -1,24 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { AvgPoolAttrs, AvgPoolInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
import { MathBackendCPU } from '../backend_cpu';
export declare function avgPool(args: {
inputs: AvgPoolInputs;
backend: MathBackendCPU;
attrs: AvgPoolAttrs;
}): TensorInfo;
export declare const avgPoolConfig: KernelConfig;
@@ -1,48 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { AvgPool, backend_util, util } from '@tensorflow/tfjs-core';
import { assertNotComplex } from '../cpu_util';
import { pool } from '../utils/pool_utils';
import { identity } from './Identity';
export function avgPool(args) {
const { inputs, backend, attrs } = args;
const { x } = inputs;
assertNotComplex(x, 'avgPool');
const { filterSize, strides, pad, dimRoundingMode } = attrs;
const dilations = 1;
util.assert(backend_util.eitherStridesOrDilationsAreOne(strides, dilations), () => 'Error in avgPool: Either strides or dilations must be 1. ' +
`Got strides ${strides} and dilations '${dilations}'`);
const convInfo = backend_util.computePool2DInfo(x.shape, filterSize, strides, dilations, pad, dimRoundingMode);
let res;
if (convInfo.filterWidth === 1 && convInfo.filterHeight === 1 &&
util.arraysEqual(convInfo.inShape, convInfo.outShape)) {
res = identity({ inputs: { x }, backend });
}
else {
const xValues = backend.data.get(x.dataId).values;
const strides = util.computeStrides(x.shape);
const buffer = pool(xValues, x.shape, x.dtype, strides, convInfo, 'avg');
res = backend.makeTensorInfo(convInfo.outShape, x.dtype, buffer.values);
}
return res;
}
export const avgPoolConfig =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CAAC,QAAQ,CAAC,EAAE;QACzD,GAAG,GAAG,QAAQ,CAAC,EAAC,MAAM,EAAE,EAAC,CAAC,EAAC,EAAE,OAAO,EAAC,CAAC,CAAC;KACxC;SAAM;QACL,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAoB,CAAC;QAChE,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QACzE,GAAG,GAAG,OAAO,CAAC,cAAc,CACxB,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,MAAoB,CAAC,CAAC;KAC9D;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAiB;IACzC,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,OAA2B;CACxC,CAAC"}
@@ -1,24 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { AvgPool3DAttrs, AvgPool3DInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
import { MathBackendCPU } from '../backend_cpu';
export declare function avgPool3D(args: {
inputs: AvgPool3DInputs;
backend: MathBackendCPU;
attrs: AvgPool3DAttrs;
}): TensorInfo;
export declare const avgPool3DConfig: KernelConfig;
@@ -1,35 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { AvgPool3D, backend_util, util } from '@tensorflow/tfjs-core';
import { assertNotComplex } from '../cpu_util';
import { pool3d } from '../utils/pool_utils';
export function avgPool3D(args) {
const { inputs, backend, attrs } = args;
const { x } = inputs;
const { filterSize, strides, pad, dimRoundingMode, dataFormat } = attrs;
assertNotComplex(x, 'avgPool3d');
const convInfo = backend_util.computePool3DInfo(x.shape, filterSize, strides, 1 /* dilations */, pad, dimRoundingMode, dataFormat);
const xValues = backend.data.get(x.dataId).values;
const outBuf = pool3d(xValues, x.shape, x.dtype, util.computeStrides(x.shape), convInfo, 'avg');
return backend.makeTensorInfo(outBuf.shape, 'float32', outBuf.values);
}
export const avgPool3DConfig = {
kernelName: AvgPool3D,
backendName: 'cpu',
kernelFunc: avgPool3D
};
//# sourceMappingURL=AvgPool3D.js.map
@@ -1 +0,0 @@
{"version":3,"file":"AvgPool3D.js","sourceRoot":"","sources":["../../src/kernels/AvgPool3D.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,SAAS,EAAmC,YAAY,EAAoD,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAGvJ,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAC;AAE3C,MAAM,UAAU,SAAS,CAAC,IAIzB;IACC,MAAM,EAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC;IACtC,MAAM,EAAC,CAAC,EAAC,GAAG,MAAM,CAAC;IACnB,MAAM,EAAC,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,UAAU,EAAC,GAAG,KAAK,CAAC;IAEtE,gBAAgB,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;IAEjC,MAAM,QAAQ,GAAG,YAAY,CAAC,iBAAiB,CAC3C,CAAC,CAAC,KAAiD,EAAE,UAAU,EAAE,OAAO,EACxE,CAAC,CAAC,eAAe,EAAE,GAAG,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;IAEzD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAoB,CAAC;IAChE,MAAM,MAAM,GAAG,MAAM,CACjB,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IAE9E,OAAO,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAiB;IAC3C,UAAU,EAAE,SAAS;IACrB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,SAA6B;CAC1C,CAAC"}
@@ -1,24 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { AvgPool3DGradAttrs, AvgPool3DGradInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
import { MathBackendCPU } from '../backend_cpu';
export declare function avgPool3DGrad(args: {
inputs: AvgPool3DGradInputs;
backend: MathBackendCPU;
attrs: AvgPool3DGradAttrs;
}): TensorInfo;
export declare const avgPool3DGradConfig: KernelConfig;
@@ -1,89 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { AvgPool3DGrad, backend_util, buffer } from '@tensorflow/tfjs-core';
import { assertNotComplex } from '../cpu_util';
export function avgPool3DGrad(args) {
const { inputs, backend, attrs } = args;
const { dy, input } = inputs;
const { filterSize, strides, pad, dimRoundingMode } = attrs;
assertNotComplex([dy, input], 'avgPool3DGrad');
const convInfo = backend_util.computePool3DInfo(input.shape, filterSize, strides, 1 /* dilations */, pad, dimRoundingMode);
const strideDepth = convInfo.strideDepth;
const strideHeight = convInfo.strideHeight;
const strideWidth = convInfo.strideWidth;
const filterDepth = convInfo.filterDepth;
const filterHeight = convInfo.filterHeight;
const filterWidth = convInfo.filterWidth;
const dilationDepth = convInfo.dilationDepth;
const dilationHeight = convInfo.dilationHeight;
const dilationWidth = convInfo.dilationWidth;
const effectiveFilterDepth = convInfo.effectiveFilterDepth;
const effectiveFilterHeight = convInfo.effectiveFilterHeight;
const effectiveFilterWidth = convInfo.effectiveFilterWidth;
const padFront = effectiveFilterDepth - 1 - convInfo.padInfo.front;
const padLeft = effectiveFilterWidth - 1 - convInfo.padInfo.left;
const padTop = effectiveFilterHeight - 1 - convInfo.padInfo.top;
const dx = buffer(input.shape, 'float32');
const avgMultiplier = 1 / (filterDepth * filterHeight * filterWidth);
const dyBuf = backend.bufferSync(dy);
for (let batch = 0; batch < convInfo.batchSize; ++batch) {
for (let channel = 0; channel < convInfo.inChannels; ++channel) {
for (let dxDepth = 0; dxDepth < convInfo.inDepth; ++dxDepth) {
for (let dxRow = 0; dxRow < convInfo.inHeight; ++dxRow) {
for (let dxCol = 0; dxCol < convInfo.inWidth; ++dxCol) {
// Shader code begins.
const dyDepthCorner = dxDepth - padFront;
const dyRowCorner = dxRow - padTop;
const dyColCorner = dxCol - padLeft;
let dotProd = 0;
for (let wDepth = 0; wDepth < effectiveFilterDepth; wDepth += dilationDepth) {
const dyDepth = (dyDepthCorner + wDepth) / strideDepth;
if (dyDepth < 0 || dyDepth >= convInfo.outDepth ||
Math.floor(dyDepth) !== dyDepth) {
continue;
}
for (let wRow = 0; wRow < effectiveFilterHeight; wRow += dilationHeight) {
const dyRow = (dyRowCorner + wRow) / strideHeight;
if (dyRow < 0 || dyRow >= convInfo.outHeight ||
Math.floor(dyRow) !== dyRow) {
continue;
}
for (let wCol = 0; wCol < effectiveFilterWidth; wCol += dilationWidth) {
const dyCol = (dyColCorner + wCol) / strideWidth;
if (dyCol < 0 || dyCol >= convInfo.outWidth ||
Math.floor(dyCol) !== dyCol) {
continue;
}
const pixel = dyBuf.get(batch, dyDepth, dyRow, dyCol, channel);
dotProd += pixel;
}
}
}
dx.set(dotProd * avgMultiplier, batch, dxDepth, dxRow, dxCol, channel);
}
}
}
}
}
return backend.makeTensorInfo(dx.shape, dx.dtype, dx.values);
}
export const avgPool3DGradConfig = {
kernelName: AvgPool3DGrad,
backendName: 'cpu',
kernelFunc: avgPool3DGrad
};
//# sourceMappingURL=AvgPool3DGrad.js.map
@@ -1 +0,0 @@
{"version":3,"file":"AvgPool3DGrad.js","sourceRoot":"","sources":["../../src/kernels/AvgPool3DGrad.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,aAAa,EAA2C,YAAY,EAA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AAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAiB;IAC/C,UAAU,EAAE,aAAa;IACzB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,aAAiC;CAC9C,CAAC"}
@@ -1,24 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { AvgPoolGradAttrs, AvgPoolGradInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
import { MathBackendCPU } from '../backend_cpu';
export declare function avgPoolGrad(args: {
inputs: AvgPoolGradInputs;
backend: MathBackendCPU;
attrs: AvgPoolGradAttrs;
}): TensorInfo;
export declare const avgPoolGradConfig: KernelConfig;
@@ -1,76 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { AvgPoolGrad, backend_util, buffer } from '@tensorflow/tfjs-core';
import { assertNotComplex } from '../cpu_util';
export function avgPoolGrad(args) {
const { inputs, backend, attrs } = args;
const { dy, input } = inputs;
const x = input;
assertNotComplex([dy, input], 'avgPoolGrad');
const { filterSize, strides, pad } = attrs;
const convInfo = backend_util.computePool2DInfo(x.shape, filterSize, strides, 1 /* dilations */, pad);
const strideHeight = convInfo.strideHeight;
const strideWidth = convInfo.strideWidth;
const filterHeight = convInfo.filterHeight;
const filterWidth = convInfo.filterWidth;
const dilationHeight = convInfo.dilationHeight;
const dilationWidth = convInfo.dilationWidth;
const effectiveFilterHeight = convInfo.effectiveFilterHeight;
const effectiveFilterWidth = convInfo.effectiveFilterWidth;
const padLeft = effectiveFilterWidth - 1 - convInfo.padInfo.left;
const padTop = effectiveFilterHeight - 1 - convInfo.padInfo.top;
const dx = buffer(x.shape, 'float32');
const avgMultiplier = 1 / (filterHeight * filterWidth);
const dyData = backend.data.get(dy.dataId).values;
const dyBuf = buffer(dy.shape, 'float32', dyData);
for (let b = 0; b < convInfo.batchSize; ++b) {
for (let d = 0; d < convInfo.inChannels; ++d) {
for (let dxR = 0; dxR < convInfo.inHeight; ++dxR) {
for (let dxC = 0; dxC < convInfo.inWidth; ++dxC) {
// Shader code begins.
const dyRCorner = dxR - padTop;
const dyCCorner = dxC - padLeft;
let dotProd = 0;
for (let wR = 0; wR < effectiveFilterHeight; wR += dilationHeight) {
const dyR = (dyRCorner + wR) / strideHeight;
if (dyR < 0 || dyR >= convInfo.outHeight ||
Math.floor(dyR) !== dyR) {
continue;
}
for (let wC = 0; wC < effectiveFilterWidth; wC += dilationWidth) {
const dyC = (dyCCorner + wC) / strideWidth;
if (dyC < 0 || dyC >= convInfo.outWidth ||
Math.floor(dyC) !== dyC) {
continue;
}
const pixel = dyBuf.get(b, dyR, dyC, d);
dotProd += pixel;
}
}
dx.set(dotProd * avgMultiplier, b, dxR, dxC, d);
}
}
}
}
return backend.makeTensorInfo(dx.shape, dx.dtype, dx.values);
}
export const avgPoolGradConfig = {
kernelName: AvgPoolGrad,
backendName: 'cpu',
kernelFunc: avgPoolGrad
};
//# sourceMappingURL=AvgPoolGrad.js.map
@@ -1 +0,0 @@
{"version":3,"file":"AvgPoolGrad.js","sourceRoot":"","sources":["../../src/kernels/AvgP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AE;4BAC3B,SAAS;yBACV;wBACD,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,oBAAoB,EAAE,EAAE,IAAI,aAAa,EAAE;4BAC/D,MAAM,GAAG,GAAG,CAAC,SAAS,GAAG,EAAE,CAAC,GAAG,WAAW,CAAC;4BAC3C,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,IAAI,QAAQ,CAAC,QAAQ;gCACnC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE;gCAC3B,SAAS;6BACV;4BAED,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;4BACxC,OAAO,IAAI,KAAK,CAAC;yBAClB;qBACF;oBACD,EAAE,CAAC,GAAG,CAAC,OAAO,GAAG,aAAa,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;iBACjD;aACF;SACF;KACF;IACD,OAAO,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAiB;IAC7C,UAAU,EAAE,WAAW;IACvB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,WAA+B;CAC5C,CAAC"}
@@ -1,24 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { BatchMatMulAttrs, BatchMatMulInputs, KernelConfig } from '@tensorflow/tfjs-core';
import { MathBackendCPU } from '../backend_cpu';
export declare function batchMatMul(args: {
inputs: BatchMatMulInputs;
attrs: BatchMatMulAttrs;
backend: MathBackendCPU;
}): import("@tensorflow/tfjs-core").TensorInfo;
export declare const batchMatMulConfig: KernelConfig;
@@ -1,105 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { BatchMatMul, buffer, util } from '@tensorflow/tfjs-core';
import { assertNotComplex } from '../cpu_util';
import { reshape } from './Reshape';
export function batchMatMul(args) {
const { inputs, backend, attrs } = args;
const { a, b } = inputs;
const { transposeA, transposeB } = attrs;
assertNotComplex([a, b], 'matMul');
const aRank = a.shape.length;
const bRank = b.shape.length;
const innerShapeA = transposeA ? a.shape[aRank - 2] : a.shape[aRank - 1];
const innerShapeB = transposeB ? b.shape[bRank - 1] : b.shape[bRank - 2];
const outerShapeA = transposeA ? a.shape[aRank - 1] : a.shape[aRank - 2];
const outerShapeB = transposeB ? b.shape[bRank - 2] : b.shape[bRank - 1];
const outerDimsA = a.shape.slice(0, -2);
const outerDimsB = b.shape.slice(0, -2);
const batchDimA = util.sizeFromShape(outerDimsA);
const batchDimB = util.sizeFromShape(outerDimsB);
const batchDimsCompatible = batchDimA === batchDimB || batchDimA === 1 || batchDimB === 1;
util.assert(aRank >= 2 && bRank >= 2 && batchDimsCompatible, () => `Error in matMul: the input batch dimensions must either be the ` +
`same or at least one input batch dimension must be 1. Got input ` +
`batch dimensions of (${outerDimsA}) and (${outerDimsB}).`);
const outShapeOuterDims = batchDimA > batchDimB ? a.shape.slice(0, -2) : b.shape.slice(0, -2);
const outShape = outShapeOuterDims.concat([outerShapeA, outerShapeB]);
util.assert(innerShapeA === innerShapeB, () => `Error in matMul: inner shapes (${innerShapeA}) and (` +
`${innerShapeB}) of Tensors with shapes ${a.shape} and ` +
`${b.shape} and transposeA=${transposeA}` +
` and transposeB=${transposeB} must match.`);
const a3dShape = transposeA ? [batchDimA, innerShapeA, outerShapeA] :
[batchDimA, outerShapeA, innerShapeA];
const b3dShape = transposeB ? [batchDimB, outerShapeB, innerShapeB] :
[batchDimB, innerShapeB, outerShapeB];
// The rest of the implementation is designed to operate on rank-3 tensors
const a3d = reshape({ inputs: { x: a }, backend, attrs: { shape: a3dShape } });
const b3d = reshape({ inputs: { x: b }, backend, attrs: { shape: b3dShape } });
const sharedDim = transposeA ? a3d.shape[1] : a3d.shape[2];
const leftDim = transposeA ? a3d.shape[2] : a3d.shape[1];
const rightDim = transposeB ? b3d.shape[1] : b3d.shape[2];
const batchDim = Math.max(batchDimA, batchDimB);
const a3dValues = backend.data.get(a3d.dataId).values;
const b3dValues = backend.data.get(b3d.dataId).values;
const a3dStrides = util.computeStrides(a3d.shape);
const b3dStrides = util.computeStrides(b3d.shape);
const [aBatch, aOuterStep, aInnerStep] = transposeA ?
[a3dStrides[0], 1, a3dStrides[1]] :
[a3dStrides[0], a3dStrides[1], 1];
const [bInnerStep, bOuterStep, bBatch] = transposeB ?
[1, b3dStrides[1], b3dStrides[0]] :
[b3dStrides[1], 1, b3dStrides[0]];
const size = leftDim * rightDim;
const result = buffer([batchDim, leftDim, rightDim], a3d.dtype);
const resVals = result.values;
const blockSize = backend.blockSize;
for (let bi = 0; bi < batchDim; bi++) {
for (let i0 = 0; i0 < leftDim; i0 += blockSize) {
for (let j0 = 0; j0 < rightDim; j0 += blockSize) {
for (let k0 = 0; k0 < sharedDim; k0 += blockSize) {
// for when blockSize doesn't evenly divide the input
const iBlock = Math.min(i0 + blockSize, leftDim);
const jBlock = Math.min(j0 + blockSize, rightDim);
const kBlock = Math.min(k0 + blockSize, sharedDim);
for (let i = i0; i < iBlock; i++) {
for (let j = j0; j < jBlock; j++) {
let sum = 0.0;
for (let k = k0; k < kBlock; k++) {
const batchOffsetA = Math.min(bi, batchDimA - 1) * aBatch;
const batchOffsetB = Math.min(bi, batchDimB - 1) * bBatch;
const aVal = a3dValues[batchOffsetA + i * aOuterStep + k * aInnerStep];
const bVal = b3dValues[k * bInnerStep + j * bOuterStep + batchOffsetB];
sum += aVal * bVal;
}
resVals[bi * size + (i * rightDim + j)] += sum;
}
}
}
}
}
}
backend.disposeIntermediateTensorInfo(a3d);
backend.disposeIntermediateTensorInfo(b3d);
// set correct shape on output.
return backend.makeTensorInfo(outShape, result.dtype, result.values);
}
export const batchMatMulConfig = {
kernelName: BatchMatMul,
backendName: 'cpu',
kernelFunc: batchMatMul,
};
//# sourceMappingURL=BatchMatMul.js.map
@@ -1 +0,0 @@
{"version":3,"file":"BatchMatMul.js","sourceRoot":"","sources":["../../src/kernels/BatchMatMul.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,WAAW,EAAuC,MAAM,EAAwC,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAG3I,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAElC,MAAM,UAAU,WAAW,CAAC,IAI3B;IACC,MAAM,EAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC;IACtC,MAAM,EAAC,CAAC,EAAE,CAAC,EAAC,GAAG,MAAM,CAAC;IACtB,MAAM,EAAC,UAAU,EAAE,UAAU,EAAC,GAAG,KAAK,CAAC;IAEvC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAEnC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;IAC7B,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC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AChC,KAAK,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;4BAChC,IAAI,GAAG,GAAG,GAAG,CAAC;4BAEd,KAAK,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;gCAChC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,GAAG,CALine truncated
@@ -1,24 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { FusedBatchNormAttrs, FusedBatchNormInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
import { MathBackendCPU } from '../backend_cpu';
export declare function batchNorm(args: {
inputs: FusedBatchNormInputs;
backend: MathBackendCPU;
attrs: FusedBatchNormAttrs;
}): TensorInfo;
export declare const batchNormConfig: KernelConfig;
@@ -1,74 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { FusedBatchNorm, util } from '@tensorflow/tfjs-core';
import { assertNotComplex } from '../cpu_util';
export function batchNorm(args) {
const { inputs, backend, attrs } = args;
const { x, scale, offset, mean, variance } = inputs;
util.assert(mean.shape.length === variance.shape.length, () => 'Batch normalization gradient requires mean and variance to have ' +
'equal ranks.');
util.assert(offset == null || mean.shape.length === offset.shape.length, () => 'Batch normalization gradient requires mean and offset to have ' +
'equal ranks.');
util.assert(scale == null || mean.shape.length === scale.shape.length, () => 'Batch normalization gradient requires mean and scale to have ' +
'equal ranks.');
assertNotComplex([x, mean, variance, scale, offset], 'batchNorm');
let { varianceEpsilon } = attrs;
if (varianceEpsilon == null) {
varianceEpsilon = 0.001;
}
const xVals = backend.data.get(x.dataId).values;
const mVals = backend.data.get(mean.dataId).values;
const varVals = backend.data.get(variance.dataId).values;
const sVals = scale ? backend.data.get(scale.dataId).values :
new Float32Array([1]);
const offVals = offset ?
backend.data.get(offset.dataId).values :
new Float32Array([0]);
const outVals = new Float32Array(xVals.length);
const offValsLength = offVals.length;
const sValsLength = sVals.length;
const varValsLength = varVals.length;
const mValsLength = mVals.length;
let offi = 0;
let mi = 0;
let si = 0;
let vi = 0;
for (let i = 0; i < xVals.length; ++i) {
outVals[i] = offVals[offi++] +
(xVals[i] - mVals[mi++]) * sVals[si++] /
Math.sqrt(varVals[vi++] + varianceEpsilon);
if (offi >= offValsLength) {
offi = 0;
}
if (mi >= mValsLength) {
mi = 0;
}
if (si >= sValsLength) {
si = 0;
}
if (vi >= varValsLength) {
vi = 0;
}
}
return backend.makeTensorInfo(x.shape, x.dtype, outVals);
}
export const batchNormConfig = {
kernelName: FusedBatchNorm,
backendName: 'cpu',
kernelFunc: batchNorm,
};
//# sourceMappingURL=BatchNorm.js.map
@@ -1 +0,0 @@
{"version":3,"file":"BatchNorm.js","sourceRoot":"","sources":["../../src/kernels/BatchNorm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,cAAc,EAA+F,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAGxJ,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAE7C,MAAM,UAAU,SAAS,CAAC,IAIzB;IACC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EAAE;YACrB,EAAE,GAAG,CAAC,CAAC;SACR;QACD,IAAI,EAAE,IAAI,WAAW,EAAE;YACrB,EAAE,GAAG,CAAC,CAAC;SACR;QACD,IAAI,EAAE,IAAI,aAAa,EAAE;YACvB,EAAE,GAAG,CAAC,CAAC;SACR;KACF;IACD,OAAO,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAiB;IAC3C,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,SAA6B;CAC1C,CAAC"}
@@ -1,24 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { BatchToSpaceNDAttrs, BatchToSpaceNDInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
import { MathBackendCPU } from '../backend_cpu';
export declare function batchToSpaceND(args: {
inputs: BatchToSpaceNDInputs;
backend: MathBackendCPU;
attrs: BatchToSpaceNDAttrs;
}): TensorInfo;
export declare const batchToSpaceNDConfig: KernelConfig;
@@ -1,51 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { backend_util, BatchToSpaceND } from '@tensorflow/tfjs-core';
import { assertNotComplex } from '../cpu_util';
import { reshape } from './Reshape';
import { slice } from './Slice';
import { transpose } from './Transpose';
export function batchToSpaceND(args) {
const { inputs, backend, attrs } = args;
const { x } = inputs;
const { blockShape, crops } = attrs;
assertNotComplex([x], 'batchToSpaceND');
const prod = blockShape.reduce((a, b) => a * b);
const reshaped = backend_util.getReshaped(x.shape, blockShape, prod);
const permuted = backend_util.getPermuted(reshaped.length, blockShape.length);
const reshapedPermuted = backend_util.getReshapedPermuted(x.shape, blockShape, prod);
const sliceBeginCoords = backend_util.getSliceBeginCoords(crops, blockShape.length);
const sliceSize = backend_util.getSliceSize(reshapedPermuted, crops, blockShape.length);
const xReshaped = reshape({ inputs: { x }, backend, attrs: { shape: reshaped } });
const xTransposed = transpose({ inputs: { x: xReshaped }, backend, attrs: { perm: permuted } });
const xTransposedReshaped = reshape({ inputs: { x: xTransposed }, backend, attrs: { shape: reshapedPermuted } });
const result = slice({
inputs: { x: xTransposedReshaped },
backend,
attrs: { begin: sliceBeginCoords, size: sliceSize }
});
backend.disposeIntermediateTensorInfo(xReshaped);
backend.disposeIntermediateTensorInfo(xTransposed);
backend.disposeIntermediateTensorInfo(xTransposedReshaped);
return result;
}
export const batchToSpaceNDConfig = {
kernelName: BatchToSpaceND,
backendName: 'cpu',
kernelFunc: batchToSpaceND
};
//# sourceMappingURL=BatchToSpaceND.js.map
@@ -1 +0,0 @@
{"version":3,"file":"BatchToSpaceND.js","sourceRoot":"","sources":["../../src/kernels/BatchToSpaceND.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,YAAY,EAAE,cAAc,EAAkF,MAAM,uBAAuB,CAAC;AAGpJ,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,KA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C,EAAE,OAAO,EAAE,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAC,CAAC,CAAC;IAC1E,MAAM,mBAAmB,GAAG,OAAO,CAC/B,EAAC,MAAM,EAAE,EAAC,CAAC,EAAE,WAAW,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAC,KAAK,EAAE,gBAAgB,EAAC,EAAC,CAAC,CAAC;IAC3E,MAAM,MAAM,GAAG,KAAK,CAAC;QACnB,MAAM,EAAE,EAAC,CAAC,EAAE,mBAAmB,EAAC;QAChC,OAAO;QACP,KAAK,EAAE,EAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAC;KAClD,CAAC,CAAC;IAEH,OAAO,CAAC,6BAA6B,CAAC,SAAS,CAAC,CAAC;IACjD,OAAO,CAAC,6BAA6B,CAAC,WAAW,CAAC,CAAC;IACnD,OAAO,CAAC,6BAA6B,CAAC,mBAAmB,CAAC,CAAC;IAE3D,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAiB;IAChD,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,cAAkC;CAC/C,CAAC"}
@@ -1,24 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { BincountAttrs, BincountInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
import { MathBackendCPU } from '../backend_cpu';
export declare function bincount(args: {
inputs: BincountInputs;
backend: MathBackendCPU;
attrs: BincountAttrs;
}): TensorInfo;
export declare const bincountConfig: KernelConfig;
@@ -1,33 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { Bincount } from '@tensorflow/tfjs-core';
import { bincountImpl } from './Bincount_impl';
export function bincount(args) {
const { inputs, backend, attrs } = args;
const { x, weights } = inputs;
const { size } = attrs;
const xVals = backend.data.get(x.dataId).values;
const weightsVals = backend.data.get(weights.dataId).values;
const outVals = bincountImpl(xVals, weightsVals, weights.dtype, weights.shape, size);
return backend.makeTensorInfo([size], weights.dtype, outVals);
}
export const bincountConfig = {
kernelName: Bincount,
backendName: 'cpu',
kernelFunc: bincount
};
//# sourceMappingURL=Bincount.js.map
@@ -1 +0,0 @@
{"version":3,"file":"Bincount.js","sourceRoot":"","sources":["../../src/kernels/Bincount.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,QAAQ,EAAkF,MAAM,uBAAuB,CAAC;AAGhI,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C,MAAM,UAAU,QAAQ,CAAC,IAIxB;IACC,MAAM,EAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC;IACtC,MAAM,EAAC,CAAC,EAAE,OAAO,EAAC,GAAG,MAAM,CAAC;IAC5B,MAAM,EAAC,IAAI,EAAC,GAAG,KAAK,CAAC;IAErB,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAoB,CAAC;IAC9D,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAoB,CAAC;IAE1E,MAAM,OAAO,GACT,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEzE,OAAO,OAAO,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAiB;IAC1C,UAAU,EAAE,QAAQ;IACpB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,QAA4B;CACzC,CAAC"}
@@ -1,19 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { DataType, Rank, TensorBuffer, TypedArray } from '@tensorflow/tfjs-core';
export declare function bincountImpl(xVals: TypedArray, weightsVals: TypedArray, weightsDtype: DataType, weightsShape: number[], size: number): TypedArray;
export declare function bincountReduceImpl<R extends Rank>(xBuf: TensorBuffer<R>, weightsBuf: TensorBuffer<R>, size: number, binaryOutput?: boolean): TensorBuffer<R>;
@@ -1,66 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import { buffer, util } from '@tensorflow/tfjs-core';
export function bincountImpl(xVals, weightsVals, weightsDtype, weightsShape, size) {
const weightsSize = util.sizeFromShape(weightsShape);
const outVals = util.makeZerosTypedArray(size, weightsDtype);
for (let i = 0; i < xVals.length; i++) {
const value = xVals[i];
if (value < 0) {
throw new Error('Input x must be non-negative!');
}
if (value >= size) {
continue;
}
if (weightsSize > 0) {
outVals[value] += weightsVals[i];
}
else {
outVals[value] += 1;
}
}
return outVals;
}
export function bincountReduceImpl(xBuf, weightsBuf, size, binaryOutput = false) {
const numRows = xBuf.shape[0];
const numCols = xBuf.shape[1];
const outBuf = buffer([numRows, size], weightsBuf.dtype);
for (let i = 0; i < numRows; i++) {
for (let j = 0; j < numCols; j++) {
const value = xBuf.get(i, j);
if (value < 0) {
throw new Error('Input x must be non-negative!');
}
if (value >= size) {
continue;
}
if (binaryOutput) {
outBuf.set(1, i, value);
}
else {
if (weightsBuf.size > 0) {
outBuf.set(outBuf.get(i, value) + weightsBuf.get(i, j), i, value);
}
else {
outBuf.set(outBuf.get(i, value) + 1, i, value);
}
}
}
}
return outBuf;
}
//# sourceMappingURL=Bincount_impl.js.map
@@ -1 +0,0 @@
{"version":3,"file":"Bincount_impl.js","sourceRoot":"","sources":["../../src/kernels/Bincount_impl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,MAAM,EAA4C,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAE7F,MAAM,UAAU,YAAY,CACxB,KAAiB,EAAE,WAAuB,EAAE,YAAsB,EAClE,YAAsB,EAAE,IAAY;IACtC,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IACrD,MAAM,OAAO,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,YAAY,CAAe,CAAC;IAE3E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAA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