Class: CNTK::Axis

Inherits:
Object
  • Object
show all
Includes:
InspectUtil
Defined in:
lib/cntk/axis.rb,
lib/cntk/inspect.rb,
ext/cntk/cntk_wrap.cxx

Class Method Summary collapse

Instance Method Summary collapse

Methods included from InspectUtil

#inspect_methods, #inspect_methods_p

Constructor Details

#initialize(*args, self) ⇒ Object



20177
20178
20179
20180
20181
20182
20183
20184
20185
20186
20187
20188
20189
20190
20191
20192
20193
20194
20195
20196
20197
20198
20199
20200
20201
20202
20203
20204
20205
20206
20207
20208
20209
20210
20211
20212
20213
20214
20215
20216
20217
20218
20219
20220
20221
20222
20223
20224
20225
20226
20227
# File 'ext/cntk/cntk_wrap.cxx', line 20177

SWIGINTERN VALUE _wrap_new_Axis(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[2];
  int ii;
  
  argc = nargs;
  if (argc > 2) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 1) {
    int _v;
    {
      int res = SWIG_AsVal_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      return _wrap_new_Axis__SWIG_0(nargs, args, self);
    }
  }
  if (argc == 1) {
    int _v;
    int res = SWIG_AsPtr_std_wstring(argv[0], (std::wstring**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_Axis__SWIG_1(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    int res = SWIG_AsPtr_std_wstring(argv[0], (std::wstring**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_bool(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_new_Axis__SWIG_2(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 2, "Axis.new", 
    "    Axis.new(int)\n"
    "    Axis.new(std::wstring const &)\n"
    "    Axis.new(std::wstring const &, bool)\n");
  
  return Qnil;
}

Class Method Details

.all_static_axes(*args) ⇒ Object



20657
20658
20659
20660
20661
20662
20663
20664
20665
20666
20667
20668
20669
20670
20671
20672
20673
20674
20675
20676
20677
20678
20679
20680
20681
20682
20683
20684
20685
20686
# File 'ext/cntk/cntk_wrap.cxx', line 20657

SWIGINTERN VALUE
_wrap_Axis_all_static_axes(int argc, VALUE *argv, VALUE self) {
  CNTK::Axis *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (CNTK::Axis *) &CNTK::Axis::AllStaticAxes(); 
    }
    catch (const std::runtime_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (const std::invalid_argument &e) {
      SWIG_exception(SWIG_ValueError,e.what()); 
    }
    catch (const std::logic_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (...) {
      SWIG_exception(SWIG_UnknownError,"Runtime exception"); 
    }
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CNTK__Axis, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}

.default_batch_axis(*args) ⇒ Object



20625
20626
20627
20628
20629
20630
20631
20632
20633
20634
20635
20636
20637
20638
20639
20640
20641
20642
20643
20644
20645
20646
20647
20648
20649
20650
20651
20652
20653
20654
# File 'ext/cntk/cntk_wrap.cxx', line 20625

SWIGINTERN VALUE
_wrap_Axis_default_batch_axis(int argc, VALUE *argv, VALUE self) {
  CNTK::Axis *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (CNTK::Axis *) &CNTK::Axis::DefaultBatchAxis(); 
    }
    catch (const std::runtime_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (const std::invalid_argument &e) {
      SWIG_exception(SWIG_ValueError,e.what()); 
    }
    catch (const std::logic_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (...) {
      SWIG_exception(SWIG_UnknownError,"Runtime exception"); 
    }
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CNTK__Axis, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}

.default_dynamic_axis(*args) ⇒ Object



20593
20594
20595
20596
20597
20598
20599
20600
20601
20602
20603
20604
20605
20606
20607
20608
20609
20610
20611
20612
20613
20614
20615
20616
20617
20618
20619
20620
20621
20622
# File 'ext/cntk/cntk_wrap.cxx', line 20593

SWIGINTERN VALUE
_wrap_Axis_default_dynamic_axis(int argc, VALUE *argv, VALUE self) {
  CNTK::Axis *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (CNTK::Axis *) &CNTK::Axis::DefaultDynamicAxis(); 
    }
    catch (const std::runtime_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (const std::invalid_argument &e) {
      SWIG_exception(SWIG_ValueError,e.what()); 
    }
    catch (const std::logic_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (...) {
      SWIG_exception(SWIG_UnknownError,"Runtime exception"); 
    }
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CNTK__Axis, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}

.default_input_variable_dynamic_axes(*args) ⇒ Object



20529
20530
20531
20532
20533
20534
20535
20536
20537
20538
20539
20540
20541
20542
20543
20544
20545
20546
20547
20548
20549
20550
20551
20552
20553
20554
20555
20556
20557
20558
# File 'ext/cntk/cntk_wrap.cxx', line 20529

SWIGINTERN VALUE
_wrap_Axis_default_input_variable_dynamic_axes(int argc, VALUE *argv, VALUE self) {
  std::vector< CNTK::Axis,std::allocator< CNTK::Axis > > *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (std::vector< CNTK::Axis,std::allocator< CNTK::Axis > > *) &CNTK::Axis::DefaultInputVariableDynamicAxes(); 
    }
    catch (const std::runtime_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (const std::invalid_argument &e) {
      SWIG_exception(SWIG_ValueError,e.what()); 
    }
    catch (const std::logic_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (...) {
      SWIG_exception(SWIG_UnknownError,"Runtime exception"); 
    }
  }
  vresult = swig::from(static_cast< std::vector< CNTK::Axis,std::allocator< CNTK::Axis > > >(*result));
  return vresult;
fail:
  return Qnil;
}

.end_static_axis(*args) ⇒ Object



20689
20690
20691
20692
20693
20694
20695
20696
20697
20698
20699
20700
20701
20702
20703
20704
20705
20706
20707
20708
20709
20710
20711
20712
20713
20714
20715
20716
20717
20718
# File 'ext/cntk/cntk_wrap.cxx', line 20689

SWIGINTERN VALUE
_wrap_Axis_end_static_axis(int argc, VALUE *argv, VALUE self) {
  SwigValueWrapper< CNTK::Axis > result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = CNTK::Axis::EndStaticAxis(); 
    }
    catch (const std::runtime_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (const std::invalid_argument &e) {
      SWIG_exception(SWIG_ValueError,e.what()); 
    }
    catch (const std::logic_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (...) {
      SWIG_exception(SWIG_UnknownError,"Runtime exception"); 
    }
  }
  vresult = SWIG_NewPointerObj((new CNTK::Axis(static_cast< const CNTK::Axis& >(result))), SWIGTYPE_p_CNTK__Axis, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}

.from_num(n) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/cntk/axis.rb', line 4

def from_num(n)
  case n
  when nil
    all_static_axes
  when Numeric
    new(-n-1)
  when Axis
    new(-1-n.static_axis_index)
  else
    raise ArgumentError
  end
end

.unknown_dynamic_axes(*args) ⇒ Object



20561
20562
20563
20564
20565
20566
20567
20568
20569
20570
20571
20572
20573
20574
20575
20576
20577
20578
20579
20580
20581
20582
20583
20584
20585
20586
20587
20588
20589
20590
# File 'ext/cntk/cntk_wrap.cxx', line 20561

SWIGINTERN VALUE
_wrap_Axis_unknown_dynamic_axes(int argc, VALUE *argv, VALUE self) {
  std::vector< CNTK::Axis,std::allocator< CNTK::Axis > > *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (std::vector< CNTK::Axis,std::allocator< CNTK::Axis > > *) &CNTK::Axis::UnknownDynamicAxes(); 
    }
    catch (const std::runtime_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (const std::invalid_argument &e) {
      SWIG_exception(SWIG_ValueError,e.what()); 
    }
    catch (const std::logic_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (...) {
      SWIG_exception(SWIG_UnknownError,"Runtime exception"); 
    }
  }
  vresult = swig::from(static_cast< std::vector< CNTK::Axis,std::allocator< CNTK::Axis > > >(*result));
  return vresult;
fail:
  return Qnil;
}

Instance Method Details

#==(*args) ⇒ Object

call-seq:

==(other) -> bool

Equality comparison operator.



20730
20731
20732
20733
20734
20735
20736
20737
20738
20739
20740
20741
20742
20743
20744
20745
20746
20747
20748
20749
20750
20751
20752
20753
20754
20755
20756
20757
20758
20759
20760
20761
20762
20763
20764
20765
20766
20767
20768
20769
20770
20771
20772
20773
20774
20775
20776
20777
20778
# File 'ext/cntk/cntk_wrap.cxx', line 20730

SWIGINTERN VALUE
_wrap_Axis___eq__(int argc, VALUE *argv, VALUE self) {
  CNTK::Axis *arg1 = (CNTK::Axis *) 0 ;
  CNTK::Axis *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CNTK__Axis, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Axis *","__eq__", 1, self )); 
  }
  arg1 = reinterpret_cast< CNTK::Axis * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CNTK__Axis,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "CNTK::Axis const &","__eq__", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "CNTK::Axis const &","__eq__", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< CNTK::Axis * >(argp2);
  {
    try {
      result = (bool)CNTK_Axis___eq__(arg1,(CNTK::Axis const &)*arg2); 
    }
    catch (const std::runtime_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (const std::invalid_argument &e) {
      SWIG_exception(SWIG_ValueError,e.what()); 
    }
    catch (const std::logic_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (...) {
      SWIG_exception(SWIG_UnknownError,"Runtime exception"); 
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}

#inspectObject



23
24
25
# File 'lib/cntk/inspect.rb', line 23

def inspect
  inspect_methods([:name, :is_dynamic_axis])
end

#is_dynamic_axis(*args) ⇒ Object



20276
20277
20278
20279
20280
20281
20282
20283
20284
20285
20286
20287
20288
20289
20290
20291
20292
20293
20294
20295
20296
20297
20298
20299
20300
20301
20302
20303
20304
20305
20306
20307
20308
20309
20310
20311
20312
20313
# File 'ext/cntk/cntk_wrap.cxx', line 20276

SWIGINTERN VALUE
_wrap_Axis_is_dynamic_axis(int argc, VALUE *argv, VALUE self) {
  CNTK::Axis *arg1 = (CNTK::Axis *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CNTK__Axis, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Axis *","IsDynamicAxis", 1, self )); 
  }
  arg1 = reinterpret_cast< CNTK::Axis * >(argp1);
  {
    try {
      result = (bool)(arg1)->IsDynamicAxis(); 
    }
    catch (const std::runtime_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (const std::invalid_argument &e) {
      SWIG_exception(SWIG_ValueError,e.what()); 
    }
    catch (const std::logic_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (...) {
      SWIG_exception(SWIG_UnknownError,"Runtime exception"); 
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}

#is_ordered(*args) ⇒ Object



20316
20317
20318
20319
20320
20321
20322
20323
20324
20325
20326
20327
20328
20329
20330
20331
20332
20333
20334
20335
20336
20337
20338
20339
20340
20341
20342
20343
20344
20345
20346
20347
20348
20349
20350
20351
20352
20353
# File 'ext/cntk/cntk_wrap.cxx', line 20316

SWIGINTERN VALUE
_wrap_Axis_is_ordered(int argc, VALUE *argv, VALUE self) {
  CNTK::Axis *arg1 = (CNTK::Axis *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CNTK__Axis, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Axis *","IsOrdered", 1, self )); 
  }
  arg1 = reinterpret_cast< CNTK::Axis * >(argp1);
  {
    try {
      result = (bool)(arg1)->IsOrdered(); 
    }
    catch (const std::runtime_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (const std::invalid_argument &e) {
      SWIG_exception(SWIG_ValueError,e.what()); 
    }
    catch (const std::logic_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (...) {
      SWIG_exception(SWIG_UnknownError,"Runtime exception"); 
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}

#is_static_axis(*args) ⇒ Object



20236
20237
20238
20239
20240
20241
20242
20243
20244
20245
20246
20247
20248
20249
20250
20251
20252
20253
20254
20255
20256
20257
20258
20259
20260
20261
20262
20263
20264
20265
20266
20267
20268
20269
20270
20271
20272
20273
# File 'ext/cntk/cntk_wrap.cxx', line 20236

SWIGINTERN VALUE
_wrap_Axis_is_static_axis(int argc, VALUE *argv, VALUE self) {
  CNTK::Axis *arg1 = (CNTK::Axis *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CNTK__Axis, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Axis *","IsStaticAxis", 1, self )); 
  }
  arg1 = reinterpret_cast< CNTK::Axis * >(argp1);
  {
    try {
      result = (bool)(arg1)->IsStaticAxis(); 
    }
    catch (const std::runtime_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (const std::invalid_argument &e) {
      SWIG_exception(SWIG_ValueError,e.what()); 
    }
    catch (const std::logic_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (...) {
      SWIG_exception(SWIG_UnknownError,"Runtime exception"); 
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}

#name(*args) ⇒ Object



20489
20490
20491
20492
20493
20494
20495
20496
20497
20498
20499
20500
20501
20502
20503
20504
20505
20506
20507
20508
20509
20510
20511
20512
20513
20514
20515
20516
20517
20518
20519
20520
20521
20522
20523
20524
20525
20526
# File 'ext/cntk/cntk_wrap.cxx', line 20489

SWIGINTERN VALUE
_wrap_Axis_name(int argc, VALUE *argv, VALUE self) {
  CNTK::Axis *arg1 = (CNTK::Axis *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::wstring *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CNTK__Axis, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Axis *","Name", 1, self )); 
  }
  arg1 = reinterpret_cast< CNTK::Axis * >(argp1);
  {
    try {
      result = (std::wstring *) &(arg1)->Name(); 
    }
    catch (const std::runtime_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (const std::invalid_argument &e) {
      SWIG_exception(SWIG_ValueError,e.what()); 
    }
    catch (const std::logic_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (...) {
      SWIG_exception(SWIG_UnknownError,"Runtime exception"); 
    }
  }
  vresult = SWIG_From_std_wstring(static_cast< std::wstring >(*result));
  return vresult;
fail:
  return Qnil;
}

#static_axis_index(*args, self) ⇒ Object



20444
20445
20446
20447
20448
20449
20450
20451
20452
20453
20454
20455
20456
20457
20458
20459
20460
20461
20462
20463
20464
20465
20466
20467
20468
20469
20470
20471
20472
20473
20474
20475
20476
20477
20478
20479
20480
20481
20482
20483
20484
20485
20486
# File 'ext/cntk/cntk_wrap.cxx', line 20444

SWIGINTERN VALUE _wrap_Axis_static_axis_index(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CNTK__Axis, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_Axis_static_axis_index__SWIG_1(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CNTK__Axis, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_bool(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_Axis_static_axis_index__SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "Axis.static_axis_index", 
    "    int Axis.static_axis_index(bool checked)\n"
    "    int Axis.static_axis_index()\n");
  
  return Qnil;
}