@@ -44,32 +44,41 @@ public static TensorStringStyle TensorStringStyle {
4444 /// <param name="sci_mode">Enable scientific notation.</param>
4545 public static void set_printoptions (
4646 int precision ,
47- int linewidth = 100 ,
48- string newLine = " \n " ,
47+ int ? linewidth = null ,
48+ string ? newLine = null ,
4949 bool sci_mode = false )
5050 {
5151 torch . floatFormat = sci_mode ? $ "E{ precision } " : $ "F{ precision } ";
52- torch . newLine = newLine ;
53- torch . lineWidth = linewidth ;
52+ if ( newLine is not null )
53+ torch . newLine = newLine ;
54+ if ( linewidth . HasValue )
55+ torch . lineWidth = linewidth . Value ;
5456 }
5557
5658 /// <summary>
5759 /// Set options for printing.
5860 /// </summary>
61+ /// <param name="style">The default string formatting style used by ToString(), print(), and str()</param>
5962 /// <param name="floatFormat">
6063 /// The format string to use for floating point values.
6164 /// See: https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings
6265 /// </param>
6366 /// <param name="linewidth">The number of characters per line for the purpose of inserting line breaks (default = 100).</param>
6467 /// <param name="newLine">The string to use to represent new-lines. Starts out as 'Environment.NewLine'</param>
6568 public static void set_printoptions (
66- string floatFormat = "g5" ,
67- int linewidth = 100 ,
68- string newLine = "\n " )
69+ TensorStringStyle ? style = null ,
70+ string ? floatFormat = null ,
71+ int ? linewidth = null ,
72+ string ? newLine = null )
6973 {
70- torch . floatFormat = floatFormat ;
71- torch . newLine = newLine ;
72- torch . lineWidth = linewidth ;
74+ if ( style . HasValue )
75+ torch . _style = style . Value ;
76+ if ( floatFormat is not null )
77+ torch . floatFormat = floatFormat ;
78+ if ( newLine is not null )
79+ torch . newLine = newLine ;
80+ if ( linewidth . HasValue )
81+ torch . lineWidth = linewidth . Value ;
7382 }
7483
7584 public const TensorStringStyle julia = TensorStringStyle . Julia ;
0 commit comments