Skip to content

Commit dfc05b3

Browse files
Auto-convert to D2
1 parent 9a4a310 commit dfc05b3

File tree

8 files changed

+22
-22
lines changed

8 files changed

+22
-22
lines changed

integrationtest/mxnet/MNIST.d

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ private struct ImageFileHeader
292292

293293
public int numImages ()
294294
{
295-
return ntohl(this.num_images);
295+
return ntohl((&this).num_images);
296296
}
297297

298298

@@ -306,7 +306,7 @@ private struct ImageFileHeader
306306

307307
public int numRows ()
308308
{
309-
return ntohl(this.num_rows);
309+
return ntohl((&this).num_rows);
310310
}
311311

312312

@@ -320,7 +320,7 @@ private struct ImageFileHeader
320320

321321
public int numCols ()
322322
{
323-
return ntohl(this.num_cols);
323+
return ntohl((&this).num_cols);
324324
}
325325
}
326326

@@ -402,7 +402,7 @@ private struct LabelFileHeader
402402

403403
public int numLabels ()
404404
{
405-
return ntohl(this.num_labels);
405+
return ntohl((&this).num_labels);
406406
}
407407
}
408408

src/mxnet/Atomic.d

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ private struct AtomicSymbolInfo
229229

230230
public cstring toString ()
231231
{
232-
return format("{}", *this);
232+
return format("{}", *(&this));
233233
}
234234

235235

@@ -244,10 +244,10 @@ private struct AtomicSymbolInfo
244244
245245
***************************************************************************/
246246

247-
public void toString (FormatterSink sink)
247+
public void toString (scope FormatterSink sink)
248248
in
249249
{
250-
assert(this.creator !is null);
250+
assert((&this).creator !is null);
251251
}
252252
body
253253
{
@@ -263,7 +263,7 @@ private struct AtomicSymbolInfo
263263
Const!(char)* return_type;
264264

265265
invoke!(MXSymbolGetAtomicSymbolInfo)
266-
(this.creator, &name, &description,
266+
((&this).creator, &name, &description,
267267
&num_args, &arg_names, &arg_type_infos, &arg_descriptions,
268268
&key_var_num_args, &return_type);
269269

@@ -329,7 +329,7 @@ private struct AtomicSymbolList
329329

330330
public cstring toString ()
331331
{
332-
return format("{}", *this);
332+
return format("{}", *(&this));
333333
}
334334

335335

@@ -345,13 +345,13 @@ private struct AtomicSymbolList
345345
346346
***************************************************************************/
347347

348-
public void toString (FormatterSink sink)
348+
public void toString (scope FormatterSink sink)
349349
{
350350
foreach (creator; atomicSymbolCreatorList())
351351
{
352352
assert(creator !is null);
353353

354-
if (this.detailed_info)
354+
if ((&this).detailed_info)
355355
{
356356
sformat(sink, "----\n");
357357
sformat(sink, "{}", AtomicSymbolInfo(creator));

src/mxnet/Context.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public struct Context
7575

7676
public DeviceType type ()
7777
{
78-
return this.type_;
78+
return (&this).type_;
7979
}
8080

8181
unittest
@@ -93,7 +93,7 @@ public struct Context
9393

9494
public int id ()
9595
{
96-
return this.id_;
96+
return (&this).id_;
9797
}
9898

9999
unittest

src/mxnet/Handle.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public class MXNetHandle (HandleType, alias FreeHandleFunction)
285285
286286
***************************************************************************/
287287

288-
public bool exists () /* d1to2fix_inject: const */
288+
public bool exists () const
289289
{
290290
return this.c_api_handle !is null;
291291
}

src/mxnet/NDArray.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ public alias Tuple!(float, double, int, ubyte) SupportedElementTypes;
822822

823823
public template isSupportedElementType (T)
824824
{
825-
const bool isSupportedElementType =
825+
static immutable bool isSupportedElementType =
826826
IndexOf!(T, SupportedElementTypes) < SupportedElementTypes.length;
827827
}
828828

src/mxnet/Symbol.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ public class Activation : Symbol
575575
}
576576
body
577577
{
578-
const istring[] activations = ["relu", "sigmoid", "softrelu", "tanh"];
578+
static immutable istring[] activations = ["relu", "sigmoid", "softrelu", "tanh"];
579579

580580
istring key = "act_type";
581581

@@ -889,7 +889,7 @@ public class SoftmaxOutput : Symbol
889889
}
890890
body
891891
{
892-
const istring[] softmax_normalizations = ["batch", "null", "valid"];
892+
static immutable istring[] softmax_normalizations = ["batch", "null", "valid"];
893893

894894
alias typeof(Config.tupleof) ConfigTuple;
895895

@@ -1120,7 +1120,7 @@ public class Dot : Symbol
11201120
c_keys[1] = keys[1].ptr;
11211121

11221122
Immut!(char)*[2] c_values;
1123-
const istring[] true_and_false = ["false", "true"];
1123+
static immutable istring[] true_and_false = ["false", "true"];
11241124
c_values[0] = true_and_false[transpose_x].ptr;
11251125
c_values[1] = true_and_false[transpose_y].ptr;
11261126

src/mxnet/Util.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ version(UnitTest)
4949

5050
public mstring toNoLossString (in float x, mstring buf)
5151
{
52-
const max_length = 1 + // optional minus sign
52+
static immutable max_length = 1 + // optional minus sign
5353
1 + // leading decimal digit
5454
1 + // .
5555
8 + // 8 decimal digits
5656
1 + // e
5757
1 + // sign
5858
2; // decimal exponent
59-
const format_string = "{:e8}";
59+
static immutable format_string = "{:e8}";
6060

6161
enforce(buf.length >= max_length);
6262
return snformat(buf, format_string, x);

src/mxnet/c/c_api.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ int MXExecutorBindEX (SymbolHandle symbol_handle, int dev_type, int dev_id, mx_u
916916
/*!
917917
* \brief set a call back to notify the completion of operation
918918
*/
919-
int MXExecutorSetMonitorCallback (ExecutorHandle handle, ExecutorMonitorCallback callback, void* callback_handle);
919+
int MXExecutorSetMonitorCallback (ExecutorHandle handle, scope ExecutorMonitorCallback callback, void* callback_handle);
920920
//--------------------------------------------
921921
// Part 5: IO Interface
922922
//--------------------------------------------
@@ -1259,7 +1259,7 @@ int MXRtcPush (RtcHandle handle, mx_uint num_input, mx_uint num_output, NDArrayH
12591259
*/
12601260
int MXRtcFree (RtcHandle handle);
12611261

1262-
int MXCustomOpRegister (Const!(char)* op_type, CustomOpPropCreator creator);
1262+
int MXCustomOpRegister (Const!(char)* op_type, scope CustomOpPropCreator creator);
12631263

12641264
// __cplusplus
12651265

0 commit comments

Comments
 (0)