MCPcopy Index your code
hub / github.com/tensorflow/tfjs / createScalarValue

Function createScalarValue

tfjs-core/src/util.ts:28–35  ·  view source on GitHub ↗
(
    value: DataType, dtype: DataType)

Source from the content-addressed store, hash-verified

26 * Create typed array for scalar value. Used for storing in `DataStorage`.
27 */
28export function createScalarValue(
29 value: DataType, dtype: DataType): BackendValues {
30 if (dtype === 'string') {
31 return encodeString(value);
32 }
33
34 return toTypedArray([value], dtype);
35}
36
37function noConversionNeeded(a: TensorLike, dtype: DataType): boolean {
38 return (a instanceof Float32Array && dtype === 'float32') ||

Callers

nothing calls this directly

Calls 2

encodeStringFunction · 0.85
toTypedArrayFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…