torch.sym_int
function sym_int(x: number): numberCreates a symbolic integer from a numeric value.
Symbolic tensors are used in compilation and export workflows to represent values that may not be known until runtime. This is particularly useful for dynamic shapes in model export scenarios.
Symbolic tensors are not fully implemented in torch.js. This function returns the floored input value. Use explicit integer dtypes for integer operations.
Parameters
xnumber- The numeric value to convert to a symbolic integer
Returns
number– The value floored to an integer (Math.floor(x))Examples
// Convert number to symbolic integer
const sym_value = torch.sym_int(3.7);
// torch.js: returns 3 (floored)See Also
- PyTorch torch.sym_int()
- sym_float - Create symbolic floats
- sym_not - Create symbolic boolean negation