Skip to content

Commit 4e5170d

Browse files
paraditepyu10055
andauthored
feat: fix tensor class import (#7947)
Co-authored-by: Ping Yu <[email protected]>
1 parent 4687567 commit 4e5170d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tfjs-core/src/tensor_util_env.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import {ENGINE} from './engine';
1919
import {env} from './environment';
20-
import {Tensor} from './tensor';
20+
import {getGlobalTensorClass, Tensor} from './tensor';
2121
import {DataType, isWebGLData, isWebGPUData, TensorLike, WebGLData, WebGPUData} from './types';
2222
import {assert, flatten, inferDtype, isTypedArray, toTypedArray} from './util';
2323
import {bytesPerElement} from './util_base';
@@ -98,7 +98,7 @@ function assertDtype(
9898
export function convertToTensor<T extends Tensor>(
9999
x: T|TensorLike, argName: string, functionName: string,
100100
parseAsDtype: DataType|'numeric'|'string_or_numeric' = 'numeric'): T {
101-
if (x instanceof Tensor) {
101+
if (x instanceof getGlobalTensorClass()) {
102102
assertDtype(parseAsDtype, x.dtype, argName, functionName);
103103
return x;
104104
}

0 commit comments

Comments
 (0)