UNPKG

@tensorflow/tfjs-core

Version:

Hardware-accelerated JavaScript library for machine intelligence

15 lines (14 loc) 865 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var util = require("../util"); function assertParamsValid(input, begin, size) { util.assert(input.rank === begin.length, "Error in slice" + input.rank + "D: Length of begin " + begin + " must " + ("match the rank of the array (" + input.rank + ").")); util.assert(input.rank === size.length, "Error in slice" + input.rank + "D: Length of size " + size + " must " + ("match the rank of the array (" + input.rank + ").")); for (var i = 0; i < input.rank; ++i) { util.assert(begin[i] + size[i] <= input.shape[i], "Error in slice" + input.rank + "D: begin[" + i + "] + size[" + i + "] " + ("(" + (begin[i] + size[i]) + ") would overflow input.shape[" + i + "] (" + input.shape[i] + ")")); } } exports.assertParamsValid = assertParamsValid;