1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
package tensor
import "github.com/pkg/errors"
func (t *Dense) Sum(along ...int) (retVal *Dense, err error) {
var e Engine = t.e
if sumer, ok := e.(Sumer); ok {
var ret Tensor
if ret, err = sumer.Sum(t, along...); err != nil {
return
}
return ret.(*Dense), nil
}
return nil, errors.Errorf("Engine does not support Sum")
}
func (t *Dense) Max(along ...int) (retVal *Dense, err error) {
var e Engine = t.e
if maxer, ok := e.(Maxer); ok {
var ret Tensor
if ret, err = maxer.Max(t, along...); err != nil {
return
}
return ret.(*Dense), nil
}
return nil, errors.Errorf("Engine does not support Max")
}
func (t *Dense) Min(along ...int) (retVal *Dense, err error) {
var e Engine = t.e
if miner, ok := e.(Miner); ok {
var ret Tensor
if ret, err = miner.Min(t, along...); err != nil {
return
}
return ret.(*Dense), nil
}
return nil, errors.Errorf("Engine does not support Min")
}
|