Skip to content

Commit 087a02a

Browse files
Cast to 'unknown' instead of '{}' in double assertions (#7116)
Avoid casting through '{}' with 'foo as {} as Bar' and instead use 'unknown', i.e. 'foo as unknown as Bar'. This is the preferred method according to Google's style guide. Internal link: go/tsstyle#double-assertions.
1 parent aa14065 commit 087a02a

File tree

652 files changed

+788
-733
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

652 files changed

+788
-733
lines changed

tfjs-backend-cpu/src/backend_cpu.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export class MathBackendCPU extends KernelBackend {
8282
if (dtype === 'string' && values != null && values.length > 0 &&
8383
util.isString(values[0])) {
8484
const encodedValues =
85-
(values as {} as string[]).map(d => util.encodeString(d));
85+
(values as unknown as string[]).map(d => util.encodeString(d));
8686

8787
outId = this.write(encodedValues, shape, dtype);
8888
} else {

tfjs-backend-cpu/src/kernels/Abs.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ export const abs = (args: {inputs: AbsInputs, backend: MathBackendCPU}) => {
4444
export const absConfig: KernelConfig = {
4545
kernelName: Abs,
4646
backendName: 'cpu',
47-
kernelFunc: abs as {} as KernelFunc,
47+
kernelFunc: abs as unknown as KernelFunc,
4848
};

tfjs-backend-cpu/src/kernels/AddN.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ export function addN(args: {inputs: AddNInputs, backend: MathBackendCPU}):
4444
export const addNConfig: KernelConfig = {
4545
kernelName: AddN,
4646
backendName: 'cpu',
47-
kernelFunc: addN as {} as KernelFunc
47+
kernelFunc: addN as unknown as KernelFunc
4848
};

tfjs-backend-cpu/src/kernels/All.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,5 @@ export function all(
7979
export const allConfig: KernelConfig = {
8080
kernelName: All,
8181
backendName: 'cpu',
82-
kernelFunc: all as {} as KernelFunc
82+
kernelFunc: all as unknown as KernelFunc
8383
};

tfjs-backend-cpu/src/kernels/Any.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,5 @@ export function any(
7979
export const anyConfig: KernelConfig = {
8080
kernelName: Any,
8181
backendName: 'cpu',
82-
kernelFunc: any as {} as KernelFunc
82+
kernelFunc: any as unknown as KernelFunc
8383
};

tfjs-backend-cpu/src/kernels/ArgMax.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,5 @@ export function argMax(
7373
export const argMaxConfig: KernelConfig = {
7474
kernelName: ArgMax,
7575
backendName: 'cpu',
76-
kernelFunc: argMax as {} as KernelFunc
76+
kernelFunc: argMax as unknown as KernelFunc
7777
};

tfjs-backend-cpu/src/kernels/ArgMin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,5 @@ export function argMin(
7373
export const argMinConfig: KernelConfig = {
7474
kernelName: ArgMin,
7575
backendName: 'cpu',
76-
kernelFunc: argMin as {} as KernelFunc
76+
kernelFunc: argMin as unknown as KernelFunc
7777
};

tfjs-backend-cpu/src/kernels/AvgPool.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ export function avgPool(
5757
export const avgPoolConfig: KernelConfig = {
5858
kernelName: AvgPool,
5959
backendName: 'cpu',
60-
kernelFunc: avgPool as {} as KernelFunc
60+
kernelFunc: avgPool as unknown as KernelFunc
6161
};

tfjs-backend-cpu/src/kernels/AvgPool3D.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ export function avgPool3D(args: {
4646
export const avgPool3DConfig: KernelConfig = {
4747
kernelName: AvgPool3D,
4848
backendName: 'cpu',
49-
kernelFunc: avgPool3D as {} as KernelFunc
49+
kernelFunc: avgPool3D as unknown as KernelFunc
5050
};

tfjs-backend-cpu/src/kernels/AvgPool3DGrad.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,5 @@ export function avgPool3DGrad(args: {
108108
export const avgPool3DGradConfig: KernelConfig = {
109109
kernelName: AvgPool3DGrad,
110110
backendName: 'cpu',
111-
kernelFunc: avgPool3DGrad as {} as KernelFunc
111+
kernelFunc: avgPool3DGrad as unknown as KernelFunc
112112
};

tfjs-backend-cpu/src/kernels/AvgPoolGrad.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,5 @@ export function avgPoolGrad(args: {
8888
export const avgPoolGradConfig: KernelConfig = {
8989
kernelName: AvgPoolGrad,
9090
backendName: 'cpu',
91-
kernelFunc: avgPoolGrad as {} as KernelFunc
91+
kernelFunc: avgPoolGrad as unknown as KernelFunc
9292
};

tfjs-backend-cpu/src/kernels/BatchMatMul.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,5 @@ export function batchMatMul(args: {
135135
export const batchMatMulConfig: KernelConfig = {
136136
kernelName: BatchMatMul,
137137
backendName: 'cpu',
138-
kernelFunc: batchMatMul as {} as KernelFunc,
138+
kernelFunc: batchMatMul as unknown as KernelFunc,
139139
};

tfjs-backend-cpu/src/kernels/BatchNorm.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,5 @@ export function batchNorm(args: {
9090
export const batchNormConfig: KernelConfig = {
9191
kernelName: FusedBatchNorm,
9292
backendName: 'cpu',
93-
kernelFunc: batchNorm as {} as KernelFunc,
93+
kernelFunc: batchNorm as unknown as KernelFunc,
9494
};

tfjs-backend-cpu/src/kernels/BatchToSpaceND.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,5 @@ export function batchToSpaceND(args: {
6666
export const batchToSpaceNDConfig: KernelConfig = {
6767
kernelName: BatchToSpaceND,
6868
backendName: 'cpu',
69-
kernelFunc: batchToSpaceND as {} as KernelFunc
69+
kernelFunc: batchToSpaceND as unknown as KernelFunc
7070
};

tfjs-backend-cpu/src/kernels/Bincount.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ export function bincount(args: {
4141
export const bincountConfig: KernelConfig = {
4242
kernelName: Bincount,
4343
backendName: 'cpu',
44-
kernelFunc: bincount as {} as KernelFunc
44+
kernelFunc: bincount as unknown as KernelFunc
4545
};

tfjs-backend-cpu/src/kernels/Cast.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,5 @@ export function cast(
9797
export const castConfig: KernelConfig = {
9898
kernelName: Cast,
9999
backendName: 'cpu',
100-
kernelFunc: cast as {} as KernelFunc
100+
kernelFunc: cast as unknown as KernelFunc
101101
};

tfjs-backend-cpu/src/kernels/ClipByValue.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {ClipByValue, ClipByValueAttrs, KernelConfig} from '@tensorflow/tfjs-core
2020
import {unaryKernelFunc} from '../utils/unary_utils';
2121

2222
export const clipByValue = unaryKernelFunc(ClipByValue, (xi, attrs) => {
23-
const clipAttrs = attrs as {} as ClipByValueAttrs;
23+
const clipAttrs = attrs as unknown as ClipByValueAttrs;
2424
if (xi > clipAttrs.clipValueMax) {
2525
return clipAttrs.clipValueMax;
2626
}

tfjs-backend-cpu/src/kernels/Complex.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ export function complex(args: {inputs: ComplexInputs, backend: MathBackendCPU}):
4545
export const complexConfig: KernelConfig = {
4646
kernelName: Complex,
4747
backendName: 'cpu',
48-
kernelFunc: complex as {} as KernelFunc
48+
kernelFunc: complex as unknown as KernelFunc
4949
};

tfjs-backend-cpu/src/kernels/ComplexAbs.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ export const complexAbs =
4141
export const complexAbsConfig: KernelConfig = {
4242
kernelName: ComplexAbs,
4343
backendName: 'cpu',
44-
kernelFunc: complexAbs as {} as KernelFunc,
44+
kernelFunc: complexAbs as unknown as KernelFunc,
4545
};

tfjs-backend-cpu/src/kernels/Concat.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,5 @@ export function concat(
105105
export const concatConfig: KernelConfig = {
106106
kernelName: Concat,
107107
backendName: 'cpu',
108-
kernelFunc: concat as {} as KernelFunc
108+
kernelFunc: concat as unknown as KernelFunc
109109
};

tfjs-backend-cpu/src/kernels/Conv2D.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,5 @@ export function conv2D(
105105
export const conv2DConfig: KernelConfig = {
106106
kernelName: Conv2D,
107107
backendName: 'cpu',
108-
kernelFunc: conv2D as {} as KernelFunc
108+
kernelFunc: conv2D as unknown as KernelFunc
109109
};

tfjs-backend-cpu/src/kernels/Conv2DBackpropFilter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,5 @@ export function conv2DBackpropFilter(args: {
8989
export const conv2DBackpropFilterConfig: KernelConfig = {
9090
kernelName: Conv2DBackpropFilter,
9191
backendName: 'cpu',
92-
kernelFunc: conv2DBackpropFilter as {} as KernelFunc
92+
kernelFunc: conv2DBackpropFilter as unknown as KernelFunc
9393
};

tfjs-backend-cpu/src/kernels/Conv2DBackpropInput.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,5 @@ export function conv2DBackpropInput(args: {
117117
export const conv2DBackpropInputConfig: KernelConfig = {
118118
kernelName: Conv2DBackpropInput,
119119
backendName: 'cpu',
120-
kernelFunc: conv2DBackpropInput as {} as KernelFunc
120+
kernelFunc: conv2DBackpropInput as unknown as KernelFunc
121121
};

tfjs-backend-cpu/src/kernels/Conv3D.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,5 @@ export function conv3D(
111111
export const conv3DConfig: KernelConfig = {
112112
kernelName: Conv3D,
113113
backendName: 'cpu',
114-
kernelFunc: conv3D as {} as KernelFunc
114+
kernelFunc: conv3D as unknown as KernelFunc
115115
};

tfjs-backend-cpu/src/kernels/Conv3DBackpropFilterV2.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,5 @@ export function conv3DBackpropFilterV2(args: {
117117
export const conv3DBackpropFilterV2Config: KernelConfig = {
118118
kernelName: Conv3DBackpropFilterV2,
119119
backendName: 'cpu',
120-
kernelFunc: conv3DBackpropFilterV2 as {} as KernelFunc
120+
kernelFunc: conv3DBackpropFilterV2 as unknown as KernelFunc
121121
};

tfjs-backend-cpu/src/kernels/Conv3DBackpropInputV2.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,5 +124,5 @@ export function conv3DBackpropInputV2(args: {
124124
export const conv3DBackpropInputV2Config: KernelConfig = {
125125
kernelName: Conv3DBackpropInputV2,
126126
backendName: 'cpu',
127-
kernelFunc: conv3DBackpropInputV2 as {} as KernelFunc
127+
kernelFunc: conv3DBackpropInputV2 as unknown as KernelFunc
128128
};

tfjs-backend-cpu/src/kernels/CropAndResize.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,5 +162,5 @@ export function cropAndResize(args: {
162162
export const cropAndResizeConfig: KernelConfig = {
163163
kernelName: CropAndResize,
164164
backendName: 'cpu',
165-
kernelFunc: cropAndResize as {} as KernelFunc
165+
kernelFunc: cropAndResize as unknown as KernelFunc
166166
};

tfjs-backend-cpu/src/kernels/Cumprod.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,5 @@ export function cumprod(
8484
export const cumprodConfig: KernelConfig = {
8585
kernelName: Cumprod,
8686
backendName: 'cpu',
87-
kernelFunc: cumprod as {} as KernelFunc
87+
kernelFunc: cumprod as unknown as KernelFunc
8888
};

tfjs-backend-cpu/src/kernels/Cumsum.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,5 @@ export function cumsum(
8484
export const cumsumConfig: KernelConfig = {
8585
kernelName: Cumsum,
8686
backendName: 'cpu',
87-
kernelFunc: cumsum as {} as KernelFunc
87+
kernelFunc: cumsum as unknown as KernelFunc
8888
};

tfjs-backend-cpu/src/kernels/DenseBincount.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@ export function denseBincount(args: {
5454
export const denseBincountConfig: KernelConfig = {
5555
kernelName: DenseBincount,
5656
backendName: 'cpu',
57-
kernelFunc: denseBincount as {} as KernelFunc
57+
kernelFunc: denseBincount as unknown as KernelFunc
5858
};

tfjs-backend-cpu/src/kernels/DepthToSpace.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,5 @@ export function depthToSpace(args: {
7272
export const depthToSpaceConfig: KernelConfig = {
7373
kernelName: DepthToSpace,
7474
backendName: 'cpu',
75-
kernelFunc: depthToSpace as {} as KernelFunc
75+
kernelFunc: depthToSpace as unknown as KernelFunc
7676
};

tfjs-backend-cpu/src/kernels/DepthwiseConv2dNative.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,5 @@ export function depthwiseConv2dNative(args: {
104104
export const depthwiseConv2dNativeConfig: KernelConfig = {
105105
kernelName: DepthwiseConv2dNative,
106106
backendName: 'cpu',
107-
kernelFunc: depthwiseConv2dNative as {} as KernelFunc
107+
kernelFunc: depthwiseConv2dNative as unknown as KernelFunc
108108
};

tfjs-backend-cpu/src/kernels/DepthwiseConv2dNativeBackpropFilter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,5 @@ export function depthwiseConv2dNativeBackpropFilter(args: {
8383
export const depthwiseConv2dNativeBackpropFilterConfig: KernelConfig = {
8484
kernelName: DepthwiseConv2dNativeBackpropFilter,
8585
backendName: 'cpu',
86-
kernelFunc: depthwiseConv2dNativeBackpropFilter as {} as KernelFunc
86+
kernelFunc: depthwiseConv2dNativeBackpropFilter as unknown as KernelFunc
8787
};

tfjs-backend-cpu/src/kernels/DepthwiseConv2dNativeBackpropInput.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,5 @@ export function depthwiseConv2dNativeBackpropInput(args: {
106106
export const depthwiseConv2dNativeBackpropInputConfig: KernelConfig = {
107107
kernelName: DepthwiseConv2dNativeBackpropInput,
108108
backendName: 'cpu',
109-
kernelFunc: depthwiseConv2dNativeBackpropInput as {} as KernelFunc
109+
kernelFunc: depthwiseConv2dNativeBackpropInput as unknown as KernelFunc
110110
};

tfjs-backend-cpu/src/kernels/Diag.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ export function diag(args: {inputs: DiagInputs, backend: MathBackendCPU}):
4141
export const diagConfig: KernelConfig = {
4242
kernelName: Diag,
4343
backendName: 'cpu',
44-
kernelFunc: diag as {} as KernelFunc
44+
kernelFunc: diag as unknown as KernelFunc
4545
};

tfjs-backend-cpu/src/kernels/Dilation2D.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const dilation2DConfig: KernelConfig = {
2424
backendName: 'cpu',
2525
kernelFunc: ({inputs, backend, attrs}) => {
2626
const {x, filter} = inputs as Dilation2DInputs;
27-
const {strides, pad, dilations} = attrs as {} as Dilation2DAttrs;
27+
const {strides, pad, dilations} = attrs as unknown as Dilation2DAttrs;
2828
const cpuBackend = backend as MathBackendCPU;
2929

3030
const xVals = cpuBackend.data.get(x.dataId).values as TypedArray;

tfjs-backend-cpu/src/kernels/Dilation2DBackpropFilter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const dilation2DBackpropFilterConfig: KernelConfig = {
2626
kernelFunc: ({inputs, backend, attrs}) => {
2727
const {x, filter, dy} =
2828
inputs as {x: Tensor4D, filter: Tensor3D, dy: Tensor4D};
29-
const {strides, pad, dilations} = attrs as {} as Dilation2DAttrs;
29+
const {strides, pad, dilations} = attrs as unknown as Dilation2DAttrs;
3030
const cpuBackend = backend as MathBackendCPU;
3131

3232
const $x =

tfjs-backend-cpu/src/kernels/Dilation2DBackpropInput.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const dilation2DBackpropInputConfig: KernelConfig = {
2626
kernelFunc: ({inputs, backend, attrs}) => {
2727
const {x, filter, dy} =
2828
inputs as {x: Tensor4D, filter: Tensor3D, dy: Tensor4D};
29-
const {strides, pad, dilations} = attrs as {} as Dilation2DAttrs;
29+
const {strides, pad, dilations} = attrs as unknown as Dilation2DAttrs;
3030
const cpuBackend = backend as MathBackendCPU;
3131

3232
const $x =

tfjs-backend-cpu/src/kernels/Einsum.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,5 @@ export function einsum(
9898
export const einsumConfig: KernelConfig = {
9999
kernelName: Einsum,
100100
backendName: 'cpu',
101-
kernelFunc: einsum as {} as KernelFunc
101+
kernelFunc: einsum as unknown as KernelFunc
102102
};

tfjs-backend-cpu/src/kernels/EluGrad.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ export function eluGrad(args: {inputs: EluGradInputs, backend: MathBackendCPU}):
4545
export const eluGradConfig: KernelConfig = {
4646
kernelName: EluGrad,
4747
backendName: 'cpu',
48-
kernelFunc: eluGrad as {} as KernelFunc
48+
kernelFunc: eluGrad as unknown as KernelFunc
4949
};

tfjs-backend-cpu/src/kernels/ExpandDims.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ export function expandDims(args: {
4848
export const expandDimsConfig: KernelConfig = {
4949
kernelName: ExpandDims,
5050
backendName: 'cpu',
51-
kernelFunc: expandDims as {} as KernelFunc
51+
kernelFunc: expandDims as unknown as KernelFunc
5252
};

tfjs-backend-cpu/src/kernels/FFT.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ export function fft(args: {inputs: FFTInputs, backend: MathBackendCPU}):
5252
export const fftConfig: KernelConfig = {
5353
kernelName: FFT,
5454
backendName: 'cpu',
55-
kernelFunc: fft as {} as KernelFunc
55+
kernelFunc: fft as unknown as KernelFunc
5656
};

tfjs-backend-cpu/src/kernels/Fill.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function fill(args: {backend: MathBackendCPU, attrs: FillAttrs}):
3434
export const fillConfig: KernelConfig = {
3535
kernelName: Fill,
3636
backendName: 'cpu',
37-
kernelFunc: fill as {} as KernelFunc
37+
kernelFunc: fill as unknown as KernelFunc
3838
};
3939

4040
function fillValues(

tfjs-backend-cpu/src/kernels/FusedConv2D.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,5 @@ export function fusedConv2D(args: {
9797
export const fusedConv2DConfig: KernelConfig = {
9898
kernelName: FusedConv2D,
9999
backendName: 'cpu',
100-
kernelFunc: fusedConv2D as {} as KernelFunc
100+
kernelFunc: fusedConv2D as unknown as KernelFunc
101101
};

tfjs-backend-cpu/src/kernels/FusedDepthwiseConv2D.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@ export function fusedDepthwiseConv2D(args: {
6363
export const fusedDepthwiseConv2DConfig: KernelConfig = {
6464
kernelName: FusedDepthwiseConv2D,
6565
backendName: 'cpu',
66-
kernelFunc: fusedDepthwiseConv2D as {} as KernelFunc
66+
kernelFunc: fusedDepthwiseConv2D as unknown as KernelFunc
6767
};

tfjs-backend-cpu/src/kernels/GatherNd.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ export function gatherNd(
4949
export const gatherNdConfig: KernelConfig = {
5050
kernelName: GatherNd,
5151
backendName: 'cpu',
52-
kernelFunc: gatherNd as {} as KernelFunc
52+
kernelFunc: gatherNd as unknown as KernelFunc
5353
};

tfjs-backend-cpu/src/kernels/GatherV2.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,5 @@ export function gatherV2(args: {
9292
export const gatherV2Config: KernelConfig = {
9393
kernelName: GatherV2,
9494
backendName: 'cpu',
95-
kernelFunc: gatherV2 as {} as KernelFunc
95+
kernelFunc: gatherV2 as unknown as KernelFunc
9696
};

tfjs-backend-cpu/src/kernels/IFFT.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ export function ifft(args: {inputs: IFFTInputs, backend: MathBackendCPU}):
5252
export const ifftConfig: KernelConfig = {
5353
kernelName: IFFT,
5454
backendName: 'cpu',
55-
kernelFunc: ifft as {} as KernelFunc
55+
kernelFunc: ifft as unknown as KernelFunc
5656
};

tfjs-backend-cpu/src/kernels/Identity.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ export function identity(
3232
export const identityConfig: KernelConfig = {
3333
kernelName: Identity,
3434
backendName: 'cpu',
35-
kernelFunc: identity as {} as KernelFunc
35+
kernelFunc: identity as unknown as KernelFunc
3636
};

tfjs-backend-cpu/src/kernels/Imag.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ export function imag(args: {inputs: ImagInputs, backend: MathBackendCPU}):
3636
export const imagConfig: KernelConfig = {
3737
kernelName: Imag,
3838
backendName: 'cpu',
39-
kernelFunc: imag as {} as KernelFunc
39+
kernelFunc: imag as unknown as KernelFunc
4040
};

tfjs-backend-cpu/src/kernels/LRN.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@ export function lRN(
6363
export const LRNConfig: KernelConfig = {
6464
kernelName: LRN,
6565
backendName: 'cpu',
66-
kernelFunc: lRN as {} as KernelFunc
66+
kernelFunc: lRN as unknown as KernelFunc
6767
};

tfjs-backend-cpu/src/kernels/LRNGrad.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@ export function lRNGrad(
6969
export const LRNGradConfig: KernelConfig = {
7070
kernelName: LRNGrad,
7171
backendName: 'cpu',
72-
kernelFunc: lRNGrad as {} as KernelFunc
72+
kernelFunc: lRNGrad as unknown as KernelFunc
7373
};

tfjs-backend-cpu/src/kernels/LeakyRelu.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ export function leakyRelu(args: {
4545
export const leakyReluConfig: KernelConfig = {
4646
kernelName: LeakyRelu,
4747
backendName: 'cpu',
48-
kernelFunc: leakyRelu as {} as KernelFunc
48+
kernelFunc: leakyRelu as unknown as KernelFunc
4949
};

tfjs-backend-cpu/src/kernels/LinSpace.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ export function linSpace(args: {backend: MathBackendCPU, attrs: LinSpaceAttrs}):
3333
export const linSpaceConfig: KernelConfig = {
3434
kernelName: LinSpace,
3535
backendName: 'cpu',
36-
kernelFunc: linSpace as {} as KernelFunc
36+
kernelFunc: linSpace as unknown as KernelFunc
3737
};

tfjs-backend-cpu/src/kernels/Max.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,5 @@ export function max(
7474
export const maxConfig: KernelConfig = {
7575
kernelName: Max,
7676
backendName: 'cpu',
77-
kernelFunc: max as {} as KernelFunc
77+
kernelFunc: max as unknown as KernelFunc
7878
};

0 commit comments

Comments
 (0)