import { Order } from 'blockly/javascript';
/**
* @category AI
* @subcategory Operations
* @module SlicingAndJoiningOperations
*/
/**
* Creates a new tensor by applying sparse updates to individual values or slices to the passed in tensor according to indices.
*
* @param {Tensor} tensor A Tensor. Tensor to copy/update.
* @param {Tensor} indices The tensor contains the indices into the output tensor, must have at least 2 axes: (num_updates, index_depth).
* @param {Tensor} updates The tensor contains the value for the indices.
* @returns {Tensor} tf.tensorScatterUpdate(tensor, indices, updates)
*/
function scatterUpdate(block, generator) {
const tensor = generator.valueToCode(block, 'TENSOR_VALUES', Order.NONE) || ''; //tensor to update
const indices = generator.valueToCode(block, 'INDICES', Order.NONE) || ''; //indices
const updates = generator.valueToCode(block, 'VALUES', Order.NONE) || ''; //values to update with
return [`tf.tensorScatterUpdate(${tensor}, ${indices}, ${updates})`, Order.VOID];
}
export const slicingAndJoiningBlockGenerator = {
['scatter_update']: scatterUpdate,
};
//# sourceMappingURL=generators.js.map
Source