torch.sym_float
function sym_float(x: number): numberCreates a symbolic float from a numeric value.
Symbolic tensors are used in PyTorch's export and compilation workflows to represent tensor shapes and values that are not known at trace time. This is useful for dynamic shapes and conditional logic in exported models.
Symbolic tensors are not implemented in torch.js. This function returns the input unchanged. Use dynamic shapes with tensor operations instead.
Parameters
xnumber- The numeric value to convert to a symbolic float
Returns
number– The numeric value (unchanged in torch.js)Examples
// Convert number to symbolic float
const sym_value = torch.sym_float(3.14);
// torch.js: returns the same value (3.14)See Also
- PyTorch torch.sym_float()
- sym_int - Create symbolic integers
- sym_not - Create symbolic boolean negation