Class: CNTK::NDShape
- Inherits:
-
Object
- Object
- CNTK::NDShape
- Defined in:
- lib/cntk/inspect.rb,
lib/cntk/ndshape.rb,
ext/cntk/cntk_wrap.cxx
Class Method Summary collapse
Instance Method Summary collapse
-
#==(*args) ⇒ Object
call-seq: ==(other) -> bool.
- #append_shape(*args) ⇒ Object
- #dimensions(*args) ⇒ Object
- #initialize(*args, self) ⇒ Object constructor
- #inspect ⇒ Object
- #is_unknown(*args) ⇒ Object
- #rank(*args) ⇒ Object
- #reverse ⇒ Object
- #sub_shape(*args, self) ⇒ Object
- #to_a ⇒ Object
- #to_ary ⇒ Object
- #total_size(*args) ⇒ Object
Constructor Details
#initialize(*args, self) ⇒ Object
18422 18423 18424 18425 18426 18427 18428 18429 18430 18431 18432 18433 18434 18435 18436 18437 18438 18439 18440 18441 18442 18443 18444 18445 18446 18447 18448 18449 18450 18451 18452 18453 18454 18455 18456 18457 18458 18459 18460 18461 18462 18463 18464 18465 18466 18467 18468 18469 18470 18471 18472 18473 18474 18475 18476 18477 18478 |
# File 'ext/cntk/cntk_wrap.cxx', line 18422
SWIGINTERN VALUE _wrap_new_NDShape(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 == 0) {
return _wrap_new_NDShape__SWIG_0(nargs, args, self);
}
if (argc == 1) {
int _v;
{
int res = SWIG_AsVal_size_t(argv[0], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_new_NDShape__SWIG_1(nargs, args, self);
}
}
if (argc == 1) {
int _v;
int res = swig::asptr(argv[0], (std::vector< size_t,std::allocator< size_t > >**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_NDShape__SWIG_3(nargs, args, self);
}
}
if (argc == 2) {
int _v;
{
int res = SWIG_AsVal_size_t(argv[0], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
{
int res = SWIG_AsVal_size_t(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_new_NDShape__SWIG_2(nargs, args, self);
}
}
}
fail:
Ruby_Format_OverloadedError( argc, 2, "NDShape.new",
" NDShape.new()\n"
" NDShape.new(size_t)\n"
" NDShape.new(size_t, size_t)\n"
" NDShape.new(std::vector< size_t,std::allocator< size_t > > const &)\n");
return Qnil;
}
|
Class Method Details
Instance Method Details
#==(*args) ⇒ Object
call-seq:
==(other) -> bool
Equality comparison operator.
18933 18934 18935 18936 18937 18938 18939 18940 18941 18942 18943 18944 18945 18946 18947 18948 18949 18950 18951 18952 18953 18954 18955 18956 18957 18958 18959 18960 18961 18962 18963 18964 18965 18966 18967 18968 18969 18970 18971 18972 18973 18974 18975 18976 18977 18978 18979 18980 18981 18982 18983 18984 18985 18986 18987 |
# File 'ext/cntk/cntk_wrap.cxx', line 18933
SWIGINTERN VALUE
_wrap_NDShape___eq__(int argc, VALUE *argv, VALUE self) {
CNTK::NDShape *arg1 = (CNTK::NDShape *) 0 ;
CNTK::NDShape *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
CNTK::NDShape tmp2 ;
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__NDShape, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::NDShape *","__eq__", 1, self ));
}
arg1 = reinterpret_cast< CNTK::NDShape * >(argp1);
{
VALUE arry = rb_check_array_type(argv[0]);
if(NIL_P(arry)) {
rb_raise(rb_eArgError, "Array expected"); SWIG_fail;
}else{
size_t rank = RARRAY_LEN(arry);
std::vector<size_t> dimensions(rank);
for (int i=0; i < rank; i++) {
VALUE elt = RARRAY_AREF(arry, i);
dimensions[rank-i-1] = NUM2SIZET(elt);
}
tmp2 = CNTK::NDShape(dimensions);
arg2 = &tmp2;
}
}
{
try {
result = (bool)CNTK_NDShape___eq__(arg1,(CNTK::NDShape 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;
}
|
#append_shape(*args) ⇒ Object
18858 18859 18860 18861 18862 18863 18864 18865 18866 18867 18868 18869 18870 18871 18872 18873 18874 18875 18876 18877 18878 18879 18880 18881 18882 18883 18884 18885 18886 18887 18888 18889 18890 18891 18892 18893 18894 18895 18896 18897 18898 18899 18900 18901 18902 18903 18904 18905 18906 18907 18908 18909 18910 18911 18912 |
# File 'ext/cntk/cntk_wrap.cxx', line 18858
SWIGINTERN VALUE
_wrap_NDShape_append_shape(int argc, VALUE *argv, VALUE self) {
CNTK::NDShape *arg1 = (CNTK::NDShape *) 0 ;
CNTK::NDShape *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
CNTK::NDShape tmp2 ;
CNTK::NDShape 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__NDShape, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::NDShape *","AppendShape", 1, self ));
}
arg1 = reinterpret_cast< CNTK::NDShape * >(argp1);
{
VALUE arry = rb_check_array_type(argv[0]);
if(NIL_P(arry)) {
rb_raise(rb_eArgError, "Array expected"); SWIG_fail;
}else{
size_t rank = RARRAY_LEN(arry);
std::vector<size_t> dimensions(rank);
for (int i=0; i < rank; i++) {
VALUE elt = RARRAY_AREF(arry, i);
dimensions[rank-i-1] = NUM2SIZET(elt);
}
tmp2 = CNTK::NDShape(dimensions);
arg2 = &tmp2;
}
}
{
try {
result = (arg1)->AppendShape((CNTK::NDShape 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_NewPointerObj((new CNTK::NDShape(static_cast< const CNTK::NDShape& >(result))), SWIGTYPE_p_CNTK__NDShape, SWIG_POINTER_OWN | 0 );
return vresult;
fail:
return Qnil;
}
|
#dimensions(*args) ⇒ Object
18487 18488 18489 18490 18491 18492 18493 18494 18495 18496 18497 18498 18499 18500 18501 18502 18503 18504 18505 18506 18507 18508 18509 18510 18511 18512 18513 18514 18515 18516 18517 18518 18519 18520 18521 18522 18523 18524 |
# File 'ext/cntk/cntk_wrap.cxx', line 18487
SWIGINTERN VALUE
_wrap_NDShape_dimensions(int argc, VALUE *argv, VALUE self) {
CNTK::NDShape *arg1 = (CNTK::NDShape *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
std::vector< size_t,std::allocator< size_t > > *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__NDShape, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::NDShape *","Dimensions", 1, self ));
}
arg1 = reinterpret_cast< CNTK::NDShape * >(argp1);
{
try {
result = (std::vector< size_t,std::allocator< size_t > > *) &(arg1)->Dimensions();
}
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< size_t,std::allocator< size_t > > >(*result));
return vresult;
fail:
return Qnil;
}
|
#inspect ⇒ Object
29 30 31 |
# File 'lib/cntk/inspect.rb', line 29 def inspect to_a.inspect end |
#is_unknown(*args) ⇒ Object
18527 18528 18529 18530 18531 18532 18533 18534 18535 18536 18537 18538 18539 18540 18541 18542 18543 18544 18545 18546 18547 18548 18549 18550 18551 18552 18553 18554 18555 18556 18557 18558 18559 18560 18561 18562 18563 18564 |
# File 'ext/cntk/cntk_wrap.cxx', line 18527
SWIGINTERN VALUE
_wrap_NDShape_is_unknown(int argc, VALUE *argv, VALUE self) {
CNTK::NDShape *arg1 = (CNTK::NDShape *) 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__NDShape, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::NDShape *","IsUnknown", 1, self ));
}
arg1 = reinterpret_cast< CNTK::NDShape * >(argp1);
{
try {
result = (bool)(arg1)->IsUnknown();
}
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;
}
|
#rank(*args) ⇒ Object
18567 18568 18569 18570 18571 18572 18573 18574 18575 18576 18577 18578 18579 18580 18581 18582 18583 18584 18585 18586 18587 18588 18589 18590 18591 18592 18593 18594 18595 18596 18597 18598 18599 18600 18601 18602 18603 18604 |
# File 'ext/cntk/cntk_wrap.cxx', line 18567
SWIGINTERN VALUE
_wrap_NDShape_rank(int argc, VALUE *argv, VALUE self) {
CNTK::NDShape *arg1 = (CNTK::NDShape *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
size_t 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__NDShape, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::NDShape *","Rank", 1, self ));
}
arg1 = reinterpret_cast< CNTK::NDShape * >(argp1);
{
try {
result = (arg1)->Rank();
}
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_size_t(static_cast< size_t >(result));
return vresult;
fail:
return Qnil;
}
|
#reverse ⇒ Object
11 12 13 |
# File 'lib/cntk/ndshape.rb', line 11 def reverse dimensions end |
#sub_shape(*args, self) ⇒ Object
18751 18752 18753 18754 18755 18756 18757 18758 18759 18760 18761 18762 18763 18764 18765 18766 18767 18768 18769 18770 18771 18772 18773 18774 18775 18776 18777 18778 18779 18780 18781 18782 18783 18784 18785 18786 18787 18788 18789 18790 18791 18792 18793 18794 18795 18796 18797 18798 18799 18800 18801 18802 18803 18804 18805 18806 18807 18808 18809 18810 18811 18812 18813 18814 18815 |
# File 'ext/cntk/cntk_wrap.cxx', line 18751
SWIGINTERN VALUE _wrap_NDShape_sub_shape(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[4];
int ii;
argc = nargs + 1;
argv[0] = self;
if (argc > 4) 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__NDShape, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_NDShape_sub_shape__SWIG_0(nargs, args, self);
}
}
if (argc == 2) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CNTK__NDShape, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_size_t(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_NDShape_sub_shape__SWIG_1(nargs, args, self);
}
}
}
if (argc == 3) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CNTK__NDShape, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_size_t(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
{
int res = SWIG_AsVal_size_t(argv[2], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_NDShape_sub_shape__SWIG_2(nargs, args, self);
}
}
}
}
fail:
Ruby_Format_OverloadedError( argc, 4, "NDShape.sub_shape",
" CNTK::NDShape NDShape.sub_shape()\n"
" CNTK::NDShape NDShape.sub_shape(size_t)\n"
" CNTK::NDShape NDShape.sub_shape(size_t, size_t)\n");
return Qnil;
}
|
#to_a ⇒ Object
7 8 9 |
# File 'lib/cntk/ndshape.rb', line 7 def to_a to_ary end |
#to_ary ⇒ Object
3 4 5 |
# File 'lib/cntk/ndshape.rb', line 3 def to_ary dimensions.reverse end |
#total_size(*args) ⇒ Object
18818 18819 18820 18821 18822 18823 18824 18825 18826 18827 18828 18829 18830 18831 18832 18833 18834 18835 18836 18837 18838 18839 18840 18841 18842 18843 18844 18845 18846 18847 18848 18849 18850 18851 18852 18853 18854 18855 |
# File 'ext/cntk/cntk_wrap.cxx', line 18818
SWIGINTERN VALUE
_wrap_NDShape_total_size(int argc, VALUE *argv, VALUE self) {
CNTK::NDShape *arg1 = (CNTK::NDShape *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
size_t 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__NDShape, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::NDShape *","TotalSize", 1, self ));
}
arg1 = reinterpret_cast< CNTK::NDShape * >(argp1);
{
try {
result = (arg1)->TotalSize();
}
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_size_t(static_cast< size_t >(result));
return vresult;
fail:
return Qnil;
}
|