gorgonia.org/gorgonia@v0.9.17/x/vm/op_test.go (about) 1 package xvm 2 3 import ( 4 "hash" 5 6 "github.com/chewxy/hm" 7 "gorgonia.org/gorgonia" 8 "gorgonia.org/tensor" 9 ) 10 11 type noOpTest struct { 12 err error 13 } 14 15 /* Graph Building Related Methods */ // Arity returns the number of inputs the Op expects. -1 indicates that it's n-ary and will be determined at runtime 16 func (u *noOpTest) Arity() int { 17 panic("not implemented") // TODO: Implement 18 } 19 20 // Informs the type of the Op (not the node). This will be used by the type system to infer the final type of the node 21 func (u *noOpTest) Type() hm.Type { 22 panic("not implemented") // TODO: Implement 23 } 24 25 // returns the output shape as a function of the inputs 26 func (u *noOpTest) InferShape(_ ...gorgonia.DimSizer) (tensor.Shape, error) { 27 panic("not implemented") // TODO: Implement 28 } 29 30 /* Machine related */ // executes the op 31 func (u *noOpTest) Do(v ...gorgonia.Value) (gorgonia.Value, error) { 32 if u.err != nil { 33 return nil, u.err 34 } 35 return v[0], nil 36 } 37 38 /* Analysis Related Methods */ // indicates if the Op will return a pointer (allowing possible inplace edits) or by value 39 // if it's false, the return value of the Op will be a copy of its input 40 func (u *noOpTest) ReturnsPtr() bool { 41 panic("not implemented") // TODO: Implement 42 } 43 44 // Does this op potentially call external (cgo or cuda) functions (thereby requiring extra overhead for Go's trampolining thing) 45 func (u *noOpTest) CallsExtern() bool { 46 panic("not implemented") // TODO: Implement 47 } 48 49 // overwriteInput() is a method which states which input the output will be overwriting. 50 // This allows for some efficiency gains as the underlying arrays wouldn't have to be re-allocated. 51 // The method returns an int instead of a bool because potentially different operations may be allowed 52 // to overwrite certain inputs. For example, consider an operation to increment a value: 53 // the IncrementOp would be a unary operator, and assuming we would like to overwrite the input, 54 // the retVal of overwriteInput() will be 0 (inputs[0]). 55 // -1 is returned if overwriting of input is disallowed 56 func (u *noOpTest) OverwritesInput() int { 57 panic("not implemented") // TODO: Implement 58 } 59 60 /* Other methods */ 61 func (u *noOpTest) WriteHash(h hash.Hash) { 62 panic("not implemented") // TODO: Implement 63 } 64 65 func (u *noOpTest) Hashcode() uint32 { 66 panic("not implemented") // TODO: Implement 67 } 68 69 func (u *noOpTest) String() string { 70 panic("not implemented") // TODO: Implement 71 }