func (tsr *Int) CopyShapeFrom(frm Tensor) {
	tsr.SetShape(frm.Shapes(), frm.Strides(), frm.DimNames())
}
CopyShapeFrom copies just the shape from given source tensor
calling SetShape with the shape params from source (see for more docs).
package etensor
import (
	"errors"
	"fmt"
	"log"
	"math"
	"strconv"
	"unsafe"
	"github.com/apache/arrow/go/arrow/array"
	"github.com/apache/arrow/go/arrow/memory"
	"github.com/apache/arrow/go/arrow/tensor"
	"github.com/emer/etable/bitslice"
	"github.com/goki/ki/ints"
	"github.com/goki/ki/kit"
	"gonum.org/v1/gonum/mat"
)
type Int struct {
	Shape
	Values []int
	Nulls  bitslice.Slice
	Meta   map[string]string
}
func NewInt(shape, strides []int, names []string) *Int {
	tsr := &Int{}
	tsr.SetShape(shape, strides, names)
	tsr.Values = make([]int, tsr.Len())
	return tsr
}
func NewIntShape(shape *Shape, vals []int) *Int {
	tsr := &Int{}
	tsr.CopyShape(shape)
	if vals != nil {
		if len(vals) != tsr.Len() {
			log.Printf("etensor.New*Shape: length of provided vals: %d not proper length: %d", len(vals), tsr.Len())
			tsr.Values = make([]int, tsr.Len())
		} else {
			tsr.Values = vals
		}
	} else {
		tsr.Values = make([]int, tsr.Len())
	}
	return tsr
}
func (tsr *Int) ShapeObj() *Shape     { return &tsr.Shape }
func (tsr *Int) DataType() Type       { return INT }
func (tsr *Int) Value(i []int) int    { j := tsr.Offset(i); return tsr.Values[j] }
func (tsr *Int) Value1D(i int) int    { return tsr.Values[i] }
func (tsr *Int) Set(i []int, val int) { j := tsr.Offset(i); tsr.Values[j] = val }
func (tsr *Int) Set1D(i int, val int) { tsr.Values[i] = val }
func (tsr *Int) IsNull(i []int) bool {
	if tsr.Nulls == nil {
		return false
	}
	j := tsr.Offset(i)
	return tsr.Nulls.Index(j)
}
func (tsr *Int) IsNull1D(i int) bool {
	if tsr.Nulls == nil {
		return false
	}
	return tsr.Nulls.Index(i)
}
func (tsr *Int) SetNull(i []int, nul bool) {
	if tsr.Nulls == nil {
		tsr.Nulls = bitslice.Make(tsr.Len(), 0)
	}
	j := tsr.Offset(i)
	tsr.Nulls.Set(j, nul)
}
func (tsr *Int) SetNull1D(i int, nul bool) {
	if tsr.Nulls == nil {
		tsr.Nulls = bitslice.Make(tsr.Len(), 0)
	}
	tsr.Nulls.Set(i, nul)
}
func (tsr *Int) FloatVal(i []int) float64      { j := tsr.Offset(i); return float64(tsr.Values[j]) }
func (tsr *Int) SetFloat(i []int, val float64) { j := tsr.Offset(i); tsr.Values[j] = int(val) }
func (tsr *Int) StringVal(i []int) string { j := tsr.Offset(i); return kit.ToString(tsr.Values[j]) }
func (tsr *Int) SetString(i []int, val string) {
	if fv, err := strconv.ParseFloat(val, 64); err == nil {
		j := tsr.Offset(i)
		tsr.Values[j] = int(fv)
	}
}
func (tsr *Int) FloatVal1D(off int) float64      { return float64(tsr.Values[off]) }
func (tsr *Int) SetFloat1D(off int, val float64) { tsr.Values[off] = int(val) }
func (tsr *Int) FloatValRowCell(row, cell int) float64 {
	_, sz := tsr.RowCellSize()
	return float64(tsr.Values[row*sz+cell])
}
func (tsr *Int) SetFloatRowCell(row, cell int, val float64) {
	_, sz := tsr.RowCellSize()
	tsr.Values[row*sz+cell] = int(val)
}
func (tsr *Int) Floats(flt *[]float64) {
	SetFloat64SliceLen(flt, len(tsr.Values))
	for j, vl := range tsr.Values {
		(*flt)[j] = float64(vl)
	}
}
func (tsr *Int) SetFloats(vals []float64) {
	sz := ints.MinInt(len(tsr.Values), len(vals))
	for j := 0; j < sz; j++ {
		tsr.Values[j] = int(vals[j])
	}
}
func (tsr *Int) StringVal1D(off int) string { return kit.ToString(tsr.Values[off]) }
func (tsr *Int) SetString1D(off int, val string) {
	if fv, err := strconv.ParseFloat(val, 64); err == nil {
		tsr.Values[off] = int(fv)
	}
}
func (tsr *Int) StringValRowCell(row, cell int) string {
	_, sz := tsr.RowCellSize()
	return kit.ToString(tsr.Values[row*sz+cell])
}
func (tsr *Int) SetStringRowCell(row, cell int, val string) {
	if fv, err := strconv.ParseFloat(val, 64); err == nil {
		_, sz := tsr.RowCellSize()
		tsr.Values[row*sz+cell] = int(fv)
	}
}
func (tsr *Int) Range() (min, max float64, minIdx, maxIdx int) {
	minIdx = -1
	maxIdx = -1
	for j, vl := range tsr.Values {
		fv := float64(vl)
		if math.IsNaN(fv) {
			continue
		}
		if fv < min || minIdx < 0 {
			min = fv
			minIdx = j
		}
		if fv > max || maxIdx < 0 {
			max = fv
			maxIdx = j
		}
	}
	return
}
func (tsr *Int) Agg(ini float64, fun AggFunc) float64 {
	ag := ini
	for j, vl := range tsr.Values {
		val := float64(vl)
		if !tsr.IsNull1D(j) && !math.IsNaN(val) {
			ag = fun(j, val, ag)
		}
	}
	return ag
}
func (tsr *Int) Eval(res *[]float64, fun EvalFunc) {
	ln := tsr.Len()
	if len(*res) != ln {
		*res = make([]float64, ln)
	}
	for j, vl := range tsr.Values {
		val := float64(vl)
		if !tsr.IsNull1D(j) && !math.IsNaN(val) {
			(*res)[j] = fun(j, val)
		}
	}
}
func (tsr *Int) SetFunc(fun EvalFunc) {
	for j, vl := range tsr.Values {
		val := float64(vl)
		if !tsr.IsNull1D(j) && !math.IsNaN(val) {
			tsr.Values[j] = int(fun(j, val))
		}
	}
}
func (tsr *Int) SetZeros() {
	for j := range tsr.Values {
		tsr.Values[j] = 0
	}
}
func (tsr *Int) Clone() Tensor {
	csr := NewIntShape(&tsr.Shape, nil)
	copy(csr.Values, tsr.Values)
	if tsr.Nulls != nil {
		csr.Nulls = tsr.Nulls.Clone()
	}
	return csr
}
func (tsr *Int) CopyFrom(frm Tensor) {
	if fsm, ok := frm.(*Int); ok {
		copy(tsr.Values, fsm.Values)
		if fsm.Nulls != nil {
			if tsr.Nulls == nil {
				tsr.Nulls = bitslice.Make(tsr.Len(), 0)
			}
			copy(tsr.Nulls, fsm.Nulls)
		}
		return
	}
	sz := ints.MinInt(len(tsr.Values), frm.Len())
	for i := 0; i < sz; i++ {
		tsr.Values[i] = int(frm.FloatVal1D(i))
		if frm.IsNull1D(i) {
			tsr.SetNull1D(i, true)
		}
	}
}