MCPcopy
hub / github.com/tensorflow/tfjs / getValue

Method getValue

tfjs-layers/src/engine/executor.ts:139–153  ·  view source on GitHub ↗

* Get the feed value for given key. * @param key The SymbolicTensor, or its name (as a string), of which the * value is sought. * @returns If `key` exists, the corresponding feed value. * @throws ValueError: If `key` does not exist in this `FeedDict`.

(key: SymbolicTensor|string)

Source from the content-addressed store, hash-verified

137 * @throws ValueError: If `key` does not exist in this `FeedDict`.
138 */
139 getValue(key: SymbolicTensor|string): Tensor {
140 if (key instanceof SymbolicTensor) {
141 if (this.id2Value[key.id] == null) {
142 throw new ValueError(`Nonexistent key: ${key.name}`);
143 } else {
144 return this.id2Value[key.id];
145 }
146 } else {
147 const id = this.name2Id[key];
148 if (id == null) {
149 throw new ValueError(`Feed dict has no SymbolicTensor name: ${key}`);
150 }
151 return this.id2Value[id];
152 }
153 }
154
155 /**
156 * Get the feed mask for given key.

Callers 3

executeFunction · 0.95
executor_test.tsFile · 0.80
api_pb.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected