Returns the tensor resulted from performing the equal logical operation elementwise on the input tensors x and y.
| 961 | |
| 962 | |
| 963 | class Equal(Operator): |
| 964 | """ |
| 965 | Returns the tensor resulted from performing the equal logical operation |
| 966 | elementwise on the input tensors x and y. |
| 967 | """ |
| 968 | |
| 969 | def __init__(self): |
| 970 | super(Equal, self).__init__() |
| 971 | |
| 972 | def forward(self, x, y): |
| 973 | """ |
| 974 | Return `a=b`, where a and b are CTensor. |
| 975 | """ |
| 976 | return singa.__eq__(x, y) |
| 977 | |
| 978 | def backward(self, dy): |
| 979 | """ |
| 980 | Args: |
| 981 | dy (CTensor): data for the dL / dy, L is the loss |
| 982 | Raises: |
| 983 | AssertionError: no backward function for this operator |
| 984 | """ |
| 985 | assert False, ('no backward function for equal') |
| 986 | |
| 987 | |
| 988 | def equal(x, y): |