torch_result_type: Result_type

View source: R/wrapers.R

torch_result_typeR Documentation

Result_type

Description

Result_type

Usage

torch_result_type(tensor1, tensor2)

Arguments

tensor1

(Tensor or Number) an input tensor or number

tensor2

(Tensor or Number) an input tensor or number

result_type(tensor1, tensor2) -> dtype

Returns the torch_dtype that would result from performing an arithmetic operation on the provided input tensors. See type promotion documentation for more information on the type promotion logic.

Examples

if (torch_is_installed()) {

torch_result_type(tensor1 = torch_tensor(c(1, 2), dtype=torch_int()), tensor2 = 1)
}

torch documentation built on May 29, 2024, 9:54 a.m.