MCPcopy Index your code
hub / github.com/javascriptdata/danfojs / $logicalOps

Method $logicalOps

src/danfojs-base/core/frame.ts:273–307  ·  view source on GitHub ↗
(tensors: typeof tensorflow.Tensor[], operation: string)

Source from the content-addressed store, hash-verified

271 }
272
273 private $logicalOps(tensors: typeof tensorflow.Tensor[], operation: string) {
274 let newValues: number[] = []
275
276 switch (operation) {
277 case 'gt':
278 newValues = tensors[0].greater(tensors[1]).arraySync() as number[]
279 break;
280 case 'lt':
281 newValues = tensors[0].less(tensors[1]).arraySync() as number[]
282 break;
283 case 'ge':
284 newValues = tensors[0].greaterEqual(tensors[1]).arraySync() as number[]
285 break;
286 case 'le':
287 newValues = tensors[0].lessEqual(tensors[1]).arraySync() as number[]
288 break;
289 case 'eq':
290 newValues = tensors[0].equal(tensors[1]).arraySync() as number[]
291 break;
292 case 'ne':
293 newValues = tensors[0].notEqual(tensors[1]).arraySync() as number[]
294 break;
295
296 }
297
298 const newData = utils.mapIntegersToBooleans(newValues, 2)
299 return new DataFrame(
300 newData,
301 {
302 index: [...this.index],
303 columns: [...this.columns],
304 dtypes: [...this.dtypes],
305 config: { ...this.config }
306 })
307 }
308
309 private $MathOps(tensors: typeof tensorflow.Tensor[], operation: string, inplace: boolean) {
310 let tensorResult

Callers 6

ltMethod · 0.95
gtMethod · 0.95
eqMethod · 0.95
neMethod · 0.95
leMethod · 0.95
geMethod · 0.95

Calls 1

mapIntegersToBooleansMethod · 0.80

Tested by

no test coverage detected