function tensorStats(tensor) {
  const mean = _.sum(tensor.data) / tensor.data.length
  const stddev = Math.sqrt(_.sum(tensor.data.map(x => (x - mean) ** 2)) / tensor.data.length)
  return { mean, stddev }
}
calculates mean and stddev for a ndarray tensor