torch.get_printoptions
function get_printoptions(): PrintOptionsRetrieves the current tensor print options.
Returns a copy of the current print configuration used for tensor display. Use this to check current settings or save/restore print configuration.
Returned Fields:
precision: Number of decimal places (0-N)threshold: Max elements before summarizingedgeitems: Elements to show at start/endlinewidth: Character width per lineprofile: Current preset ('default', 'short', 'full')sci_mode: Use scientific notation (true/false/null for auto)
- Returns copy: Modifying the returned object doesn't affect settings
- Query-only: Does not change any options
- All fields: Returns complete set of current options
Returns
PrintOptions– Copy of current print optionsExamples
// Check current print settings
const opts = torch.get_printoptions();
console.log(`Precision: ${opts.precision}`);
console.log(`Threshold: ${opts.threshold}`);
// Save and restore settings
const saved = torch.get_printoptions();
torch.set_printoptions({ precision: 2 });
// ... do stuff ...
torch.set_printoptions(saved); // Restore
// Check which profile is active
const current = torch.get_printoptions();
console.log(`Using ${current.profile} profile`);See Also
- PyTorch torch.get_printoptions()
- set_printoptions - Update print options