-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
095692a
commit 5a6800d
Showing
129 changed files
with
4,354 additions
and
2,016 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package less | ||
|
||
import ( | ||
"github.com/advancedclimatesystems/gonnx/onnx" | ||
"github.com/advancedclimatesystems/gonnx/ops" | ||
"gorgonia.org/tensor" | ||
) | ||
|
||
var ( | ||
MinLess13Inputs = 2 | ||
MaxLess13Inputs = 2 | ||
) | ||
|
||
// Less13 represents the ONNX less operator. | ||
type Less13 struct{} | ||
|
||
// newLess13 creates a new less operator. | ||
func newLess13() ops.Operator { | ||
return &Less13{} | ||
} | ||
|
||
// Init initializes the less operator. | ||
func (l *Less13) Init(*onnx.NodeProto) error { | ||
return nil | ||
} | ||
|
||
// Apply applies the less operator. | ||
func (l *Less13) Apply(inputs []tensor.Tensor) ([]tensor.Tensor, error) { | ||
return ops.ApplyBinaryOperation( | ||
inputs[0], | ||
inputs[1], | ||
ops.Lt, | ||
ops.MultidirectionalBroadcasting, | ||
) | ||
} | ||
|
||
// ValidateInputs validates the inputs that will be given to Apply for this operator. | ||
func (l *Less13) ValidateInputs(inputs []tensor.Tensor) ([]tensor.Tensor, error) { | ||
return ops.ValidateInputs(l, inputs) | ||
} | ||
|
||
// GetMinInputs returns the minimum number of input tensors this operator expects. | ||
func (l *Less13) GetMinInputs() int { | ||
return MinLess13Inputs | ||
} | ||
|
||
// GetMaxInputs returns the maximum number of input tensors this operator expects. | ||
func (l *Less13) GetMaxInputs() int { | ||
return MaxLess13Inputs | ||
} | ||
|
||
// GetInputTypeConstraints returns a list. Every element represents a set of allowed tensor dtypes | ||
// for the corresponding input tensor. | ||
func (l *Less13) GetInputTypeConstraints() [][]tensor.Dtype { | ||
return [][]tensor.Dtype{ops.AllTypes, ops.AllTypes} | ||
} | ||
|
||
// String implements the stringer interface, and can be used to format errors or messages. | ||
func (l *Less13) String() string { | ||
return "less13 operator" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package less | ||
|
||
import ( | ||
"github.com/advancedclimatesystems/gonnx/onnx" | ||
"github.com/advancedclimatesystems/gonnx/ops" | ||
"gorgonia.org/tensor" | ||
) | ||
|
||
var ( | ||
MinLess7Inputs = 2 | ||
MaxLess7Inputs = 2 | ||
) | ||
|
||
// Less7 represents the ONNX less operator. | ||
type Less7 struct{} | ||
|
||
// newLess7 creates a new less operator. | ||
func newLess7() ops.Operator { | ||
return &Less7{} | ||
} | ||
|
||
// Init initializes the less operator. | ||
func (l *Less7) Init(*onnx.NodeProto) error { | ||
return nil | ||
} | ||
|
||
// Apply applies the less operator. | ||
func (l *Less7) Apply(inputs []tensor.Tensor) ([]tensor.Tensor, error) { | ||
return ops.ApplyBinaryOperation( | ||
inputs[0], | ||
inputs[1], | ||
ops.Lt, | ||
ops.MultidirectionalBroadcasting, | ||
) | ||
} | ||
|
||
// ValidateInputs validates the inputs that will be given to Apply for this operator. | ||
func (l *Less7) ValidateInputs(inputs []tensor.Tensor) ([]tensor.Tensor, error) { | ||
return ops.ValidateInputs(l, inputs) | ||
} | ||
|
||
// GetMinInputs returns the minimum number of input tensors this operator expects. | ||
func (l *Less7) GetMinInputs() int { | ||
return MinLess7Inputs | ||
} | ||
|
||
// GetMaxInputs returns the maximum number of input tensors this operator expects. | ||
func (l *Less7) GetMaxInputs() int { | ||
return MaxLess7Inputs | ||
} | ||
|
||
// GetInputTypeConstraints returns a list. Every element represents a set of allowed tensor dtypes | ||
// for the corresponding input tensor. | ||
func (l *Less7) GetInputTypeConstraints() [][]tensor.Dtype { | ||
return [][]tensor.Dtype{{tensor.Float32, tensor.Float64}, {tensor.Float32, tensor.Float64}} | ||
} | ||
|
||
// String implements the stringer interface, and can be used to format errors or messages. | ||
func (l *Less7) String() string { | ||
return "less7 operator" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package less | ||
|
||
import "github.com/advancedclimatesystems/gonnx/ops" | ||
|
||
var LessVersions = ops.OperatorVersions{ | ||
7: newLess7, // Only float types | ||
9: newLess9, // bfloat16 type | ||
13: newLess13, | ||
} |
Oops, something went wrong.