Learn R Programming

rTorch (version 0.4.2)

==.torch.Tensor: Compares two tensors if equal

Description

This generic is approximately similar to torch$eq(a, b), with the difference that the generic returns a tensor of booleans instead of a tensor of data type torch$uint8.

Usage

# S3 method for torch.Tensor
==(x, y)

Arguments

x

tensor

y

tensor

Value

A tensor of booleans, where False corresponds to 0, and 1 to True in a tensor of data type torch$bool.

Examples

Run this code
# NOT RUN {
a <- torch$Tensor(list(1, 1, 1))
b <- torch$Tensor(list(2, 2, 2))
a == b
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab