Native Tensor support

Robert Eisele robert at
Sat Jan 27 01:50:15 UTC 2018


Allocating multi-dimensional arrays in Javascript is only possible by 
building each dimension individually. In addition to being a very 
tedious job, a developer has no control over memory usage, which in 
general is likely to be very high.

Seeing an array algebraically as a vector, typed arrays have already 
created the ability to work more efficiently and memory-consciously with 
lists of numbers. A natural extension of this is not just a matrix, but 
a tensor.

I would like to suggest tensors as a native language construct in ES. 
This would have the advantage that developers could write highly 
parallelizable code independently of WebGL. As an API one could 
introduce the following classes in analogy to typed arrays:

- IntXTensor
- UintXTensor
- FloatXTensor

Where X is one of {8, 16, 32, 64}. To make these tensor objects really 
effective, it is necessary to introduce meaningful operations, maybe 
similar to the features of TensorFlow. I think by introducing tensors in 
the browser (but also node.js), a wide range of new applications open 
up. For example, working with deep learning right in the browser or 
calculating filters on images without having to write shaders for them.

The most important thing probably is having a way of storing high 
dimensional data in the browser without worrying about the memory 
footprint, even for complex applications.

What do you think about it?

Robert Eisele

More information about the es-discuss mailing list