Class: CNTK::Variable
- Inherits:
-
Object
- Object
- CNTK::Variable
- Defined in:
- lib/cntk/variable.rb,
ext/cntk/cntk_wrap.cxx
Constant Summary collapse
- DataType =
{ DataType_Float => Numo::SFloat, DataType_Double => Numo::DFloat, DataType_Unknown => nil }
Instance Method Summary collapse
- #*(other) ⇒ Object
- #+(other) ⇒ Object
- #-(other) ⇒ Object
-
#-@(*args) ⇒ Object
call-seq: -@ -> CNTK::FunctionPtr.
- #/(other) ⇒ Object
-
#==(*args) ⇒ Object
call-seq: ==(other) -> bool.
- #__dynamic_axes__(*args) ⇒ Object
- #coerce(other) ⇒ Object
-
#dot(other) ⇒ Object
follow Numo::Narray.
- #dynamic_axes ⇒ Object
- #get_data_type(*args) ⇒ Object
- #initialize(*args, self) ⇒ Object constructor
- #is_constant(*args) ⇒ Object
- #is_input(*args) ⇒ Object
- #is_output(*args) ⇒ Object
- #is_parameter(*args) ⇒ Object
- #is_placeholder(*args) ⇒ Object
- #is_scalar ⇒ Object
- #is_sparse(*args) ⇒ Object
- #kind(*args) ⇒ Object
- #name(*args) ⇒ Object
- #needs_gradient(*args) ⇒ Object
- #owner(*args) ⇒ Object
- #reshape(shape) ⇒ Object
- #shape(*args) ⇒ Object
- #to_function(*args) ⇒ Object
- #uid(*args) ⇒ Object
Constructor Details
#initialize(*args, self) ⇒ Object
24201 24202 24203 24204 24205 24206 24207 24208 24209 24210 24211 24212 24213 24214 24215 24216 24217 24218 24219 24220 24221 24222 24223 24224 24225 24226 24227 24228 24229 24230 24231 24232 24233 24234 24235 24236 24237 24238 24239 24240 24241 24242 24243 24244 24245 24246 24247 24248 24249 24250 24251 24252 24253 24254 24255 24256 24257 24258 24259 24260 24261 24262 24263 24264 24265 24266 24267 |
# File 'ext/cntk/cntk_wrap.cxx', line 24201 SWIGINTERN VALUE _wrap_new_Variable(int nargs, VALUE *args, VALUE self) { int argc; VALUE argv[7]; int ii; argc = nargs; if (argc > 7) SWIG_fail; for (ii = 0; (ii < argc); ++ii) { argv[ii] = args[ii]; } if (argc == 1) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__shared_ptrT_CNTK__Function_t, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_Variable__SWIG_0(nargs, args, self); } } if (argc == 7) { int _v; { // '1000' is the typecheck precedence code. It means: check after basic // types, but before arrays. See: http://www.swig.org/Doc3.0/Typemaps.html#Typemaps_overloading _v = NIL_P(rb_check_array_type(argv[0])) ? 0 : 1; } if (_v) { { int res = SWIG_AsVal_bool(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_int(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { { int res = SWIG_AsVal_bool(argv[3], NULL); _v = SWIG_CheckState(res); } if (_v) { int res = SWIG_AsPtr_std_wstring(argv[4], (std::wstring**)(0)); _v = SWIG_CheckState(res); if (_v) { int res = swig::asptr(argv[5], (std::vector< CNTK::Axis,std::allocator< CNTK::Axis > >**)(0)); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsPtr_std_wstring(argv[6], (std::wstring**)(0)); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_Variable__SWIG_1(nargs, args, self); } } } } } } } } fail: Ruby_Format_OverloadedError( argc, 7, "Variable.new", " Variable.new(CNTK::FunctionPtr const &function)\n" " Variable.new(CNTK::NDShape const &shape, bool isSparse, enum CNTK::DataType dataType, bool needsGradient, std::wstring const &name, std::vector< CNTK::Axis,std::allocator< CNTK::Axis > > const &dynamicAxes, std::wstring const &uid)\n"); return Qnil; } |
Instance Method Details
#*(other) ⇒ Object
31 32 33 |
# File 'lib/cntk/variable.rb', line 31 def *(other) Ops.element_times(self, other) end |
#+(other) ⇒ Object
39 40 41 |
# File 'lib/cntk/variable.rb', line 39 def +(other) Ops.plus(self, other) end |
#-(other) ⇒ Object
43 44 45 |
# File 'lib/cntk/variable.rb', line 43 def -(other) Ops.minus(self, other) end |
#-@(*args) ⇒ Object
call-seq:
-@ -> CNTK::FunctionPtr
Negation operator.
24951 24952 24953 24954 24955 24956 24957 24958 24959 24960 24961 24962 24963 24964 24965 24966 24967 24968 24969 24970 24971 24972 24973 24974 24975 24976 24977 24978 24979 24980 24981 24982 24983 24984 24985 24986 24987 24988 24989 24990 24991 |
# File 'ext/cntk/cntk_wrap.cxx', line 24951 SWIGINTERN VALUE _wrap_Variable___neg__(int argc, VALUE *argv, VALUE self) { CNTK::Variable *arg1 = (CNTK::Variable *) 0 ; void *argp1 = 0 ; int res1 = 0 ; CNTK::FunctionPtr 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__Variable, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Variable *","__neg__", 1, self )); } arg1 = reinterpret_cast< CNTK::Variable * >(argp1); { try { result = CNTK_Variable___neg__(arg1); } 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"); } } { std::shared_ptr< CNTK::Function > *smartresult = result ? new std::shared_ptr< CNTK::Function >(result) : 0; vresult = SWIG_NewPointerObj(SWIG_as_voidptr(smartresult), SWIGTYPE_p_std__shared_ptrT_CNTK__Function_t, SWIG_POINTER_OWN); } return vresult; fail: return Qnil; } |
#/(other) ⇒ Object
35 36 37 |
# File 'lib/cntk/variable.rb', line 35 def /(other) Ops.element_divide(self, other) end |
#==(*args) ⇒ Object
call-seq:
==(other) -> bool
Equality comparison operator.
24891 24892 24893 24894 24895 24896 24897 24898 24899 24900 24901 24902 24903 24904 24905 24906 24907 24908 24909 24910 24911 24912 24913 24914 24915 24916 24917 24918 24919 24920 24921 24922 24923 24924 24925 24926 24927 24928 24929 24930 24931 24932 24933 24934 24935 24936 24937 24938 24939 |
# File 'ext/cntk/cntk_wrap.cxx', line 24891 SWIGINTERN VALUE _wrap_Variable___eq__(int argc, VALUE *argv, VALUE self) { CNTK::Variable *arg1 = (CNTK::Variable *) 0 ; CNTK::Variable *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__Variable, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Variable *","__eq__", 1, self )); } arg1 = reinterpret_cast< CNTK::Variable * >(argp1); res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CNTK__Variable, 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "CNTK::Variable const &","__eq__", 2, argv[0] )); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "CNTK::Variable const &","__eq__", 2, argv[0])); } arg2 = reinterpret_cast< CNTK::Variable * >(argp2); { try { result = (bool)CNTK_Variable___eq__(arg1,(CNTK::Variable 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; } |
#__dynamic_axes__(*args) ⇒ Object
24316 24317 24318 24319 24320 24321 24322 24323 24324 24325 24326 24327 24328 24329 24330 24331 24332 24333 24334 24335 24336 24337 24338 24339 24340 24341 24342 24343 24344 24345 24346 24347 24348 24349 24350 24351 24352 24353 |
# File 'ext/cntk/cntk_wrap.cxx', line 24316 SWIGINTERN VALUE _wrap_Variable___dynamic_axes__(int argc, VALUE *argv, VALUE self) { CNTK::Variable *arg1 = (CNTK::Variable *) 0 ; void *argp1 = 0 ; int res1 = 0 ; 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; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CNTK__Variable, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Variable *","DynamicAxes", 1, self )); } arg1 = reinterpret_cast< CNTK::Variable * >(argp1); { try { result = (std::vector< CNTK::Axis,std::allocator< CNTK::Axis > > *) &(arg1)->DynamicAxes(); } 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; } |
#coerce(other) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/cntk/variable.rb', line 47 def coerce(other) if other.is_a?(Numeric) [CNTK::Ops.constant(other), self] else [other, self] end end |
#dot(other) ⇒ Object
follow Numo::Narray
21 22 23 24 25 26 27 28 29 |
# File 'lib/cntk/variable.rb', line 21 def dot(other) if shape.rank == 1 and other.shape.rank == 1 ret = Ops.times( Ops.reshape(self, [1,shape.total_size]), Ops.reshape(other, [other.shape.total_size, 1]) ) Ops.reshape(ret, [1]) else Ops.times(self, other) end end |
#dynamic_axes ⇒ Object
12 13 14 |
# File 'lib/cntk/variable.rb', line 12 def dynamic_axes __dynamic_axes__.reverse end |
#get_data_type(*args) ⇒ Object
24759 24760 24761 24762 24763 24764 24765 24766 24767 24768 24769 24770 24771 24772 24773 24774 24775 24776 24777 24778 24779 24780 24781 24782 24783 24784 24785 24786 24787 24788 24789 24790 24791 24792 24793 24794 24795 24796 |
# File 'ext/cntk/cntk_wrap.cxx', line 24759 SWIGINTERN VALUE _wrap_Variable_get_data_type(int argc, VALUE *argv, VALUE self) { CNTK::Variable *arg1 = (CNTK::Variable *) 0 ; void *argp1 = 0 ; int res1 = 0 ; enum CNTK::DataType 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__Variable, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Variable *","GetDataType", 1, self )); } arg1 = reinterpret_cast< CNTK::Variable * >(argp1); { try { result = (enum CNTK::DataType)(arg1)->GetDataType(); } 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_int(static_cast< int >(result)); return vresult; fail: return Qnil; } |
#is_constant(*args) ⇒ Object
24556 24557 24558 24559 24560 24561 24562 24563 24564 24565 24566 24567 24568 24569 24570 24571 24572 24573 24574 24575 24576 24577 24578 24579 24580 24581 24582 24583 24584 24585 24586 24587 24588 24589 24590 24591 24592 24593 |
# File 'ext/cntk/cntk_wrap.cxx', line 24556 SWIGINTERN VALUE _wrap_Variable_is_constant(int argc, VALUE *argv, VALUE self) { CNTK::Variable *arg1 = (CNTK::Variable *) 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__Variable, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Variable *","IsConstant", 1, self )); } arg1 = reinterpret_cast< CNTK::Variable * >(argp1); { try { result = (bool)(arg1)->IsConstant(); } 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_input(*args) ⇒ Object
24436 24437 24438 24439 24440 24441 24442 24443 24444 24445 24446 24447 24448 24449 24450 24451 24452 24453 24454 24455 24456 24457 24458 24459 24460 24461 24462 24463 24464 24465 24466 24467 24468 24469 24470 24471 24472 24473 |
# File 'ext/cntk/cntk_wrap.cxx', line 24436 SWIGINTERN VALUE _wrap_Variable_is_input(int argc, VALUE *argv, VALUE self) { CNTK::Variable *arg1 = (CNTK::Variable *) 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__Variable, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Variable *","IsInput", 1, self )); } arg1 = reinterpret_cast< CNTK::Variable * >(argp1); { try { result = (bool)(arg1)->IsInput(); } 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_output(*args) ⇒ Object
24476 24477 24478 24479 24480 24481 24482 24483 24484 24485 24486 24487 24488 24489 24490 24491 24492 24493 24494 24495 24496 24497 24498 24499 24500 24501 24502 24503 24504 24505 24506 24507 24508 24509 24510 24511 24512 24513 |
# File 'ext/cntk/cntk_wrap.cxx', line 24476 SWIGINTERN VALUE _wrap_Variable_is_output(int argc, VALUE *argv, VALUE self) { CNTK::Variable *arg1 = (CNTK::Variable *) 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__Variable, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Variable *","IsOutput", 1, self )); } arg1 = reinterpret_cast< CNTK::Variable * >(argp1); { try { result = (bool)(arg1)->IsOutput(); } 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_parameter(*args) ⇒ Object
24516 24517 24518 24519 24520 24521 24522 24523 24524 24525 24526 24527 24528 24529 24530 24531 24532 24533 24534 24535 24536 24537 24538 24539 24540 24541 24542 24543 24544 24545 24546 24547 24548 24549 24550 24551 24552 24553 |
# File 'ext/cntk/cntk_wrap.cxx', line 24516 SWIGINTERN VALUE _wrap_Variable_is_parameter(int argc, VALUE *argv, VALUE self) { CNTK::Variable *arg1 = (CNTK::Variable *) 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__Variable, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Variable *","IsParameter", 1, self )); } arg1 = reinterpret_cast< CNTK::Variable * >(argp1); { try { result = (bool)(arg1)->IsParameter(); } 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_placeholder(*args) ⇒ Object
24596 24597 24598 24599 24600 24601 24602 24603 24604 24605 24606 24607 24608 24609 24610 24611 24612 24613 24614 24615 24616 24617 24618 24619 24620 24621 24622 24623 24624 24625 24626 24627 24628 24629 24630 24631 24632 24633 |
# File 'ext/cntk/cntk_wrap.cxx', line 24596 SWIGINTERN VALUE _wrap_Variable_is_placeholder(int argc, VALUE *argv, VALUE self) { CNTK::Variable *arg1 = (CNTK::Variable *) 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__Variable, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Variable *","IsPlaceholder", 1, self )); } arg1 = reinterpret_cast< CNTK::Variable * >(argp1); { try { result = (bool)(arg1)->IsPlaceholder(); } 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_scalar ⇒ Object
8 9 10 |
# File 'lib/cntk/variable.rb', line 8 def is_scalar shape().rank == 0 end |
#is_sparse(*args) ⇒ Object
24396 24397 24398 24399 24400 24401 24402 24403 24404 24405 24406 24407 24408 24409 24410 24411 24412 24413 24414 24415 24416 24417 24418 24419 24420 24421 24422 24423 24424 24425 24426 24427 24428 24429 24430 24431 24432 24433 |
# File 'ext/cntk/cntk_wrap.cxx', line 24396 SWIGINTERN VALUE _wrap_Variable_is_sparse(int argc, VALUE *argv, VALUE self) { CNTK::Variable *arg1 = (CNTK::Variable *) 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__Variable, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Variable *","IsSparse", 1, self )); } arg1 = reinterpret_cast< CNTK::Variable * >(argp1); { try { result = (bool)(arg1)->IsSparse(); } 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; } |
#kind(*args) ⇒ Object
24356 24357 24358 24359 24360 24361 24362 24363 24364 24365 24366 24367 24368 24369 24370 24371 24372 24373 24374 24375 24376 24377 24378 24379 24380 24381 24382 24383 24384 24385 24386 24387 24388 24389 24390 24391 24392 24393 |
# File 'ext/cntk/cntk_wrap.cxx', line 24356 SWIGINTERN VALUE _wrap_Variable_kind(int argc, VALUE *argv, VALUE self) { CNTK::Variable *arg1 = (CNTK::Variable *) 0 ; void *argp1 = 0 ; int res1 = 0 ; CNTK::VariableKind 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__Variable, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Variable *","Kind", 1, self )); } arg1 = reinterpret_cast< CNTK::Variable * >(argp1); { try { result = (CNTK::VariableKind)(arg1)->Kind(); } 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_int(static_cast< int >(result)); return vresult; fail: return Qnil; } |
#name(*args) ⇒ Object
24636 24637 24638 24639 24640 24641 24642 24643 24644 24645 24646 24647 24648 24649 24650 24651 24652 24653 24654 24655 24656 24657 24658 24659 24660 24661 24662 24663 24664 24665 24666 24667 24668 24669 24670 24671 24672 24673 |
# File 'ext/cntk/cntk_wrap.cxx', line 24636 SWIGINTERN VALUE _wrap_Variable_name(int argc, VALUE *argv, VALUE self) { CNTK::Variable *arg1 = (CNTK::Variable *) 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__Variable, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Variable *","Name", 1, self )); } arg1 = reinterpret_cast< CNTK::Variable * >(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; } |
#needs_gradient(*args) ⇒ Object
24799 24800 24801 24802 24803 24804 24805 24806 24807 24808 24809 24810 24811 24812 24813 24814 24815 24816 24817 24818 24819 24820 24821 24822 24823 24824 24825 24826 24827 24828 24829 24830 24831 24832 24833 24834 24835 24836 |
# File 'ext/cntk/cntk_wrap.cxx', line 24799 SWIGINTERN VALUE _wrap_Variable_needs_gradient(int argc, VALUE *argv, VALUE self) { CNTK::Variable *arg1 = (CNTK::Variable *) 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__Variable, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Variable *","NeedsGradient", 1, self )); } arg1 = reinterpret_cast< CNTK::Variable * >(argp1); { try { result = (bool)(arg1)->NeedsGradient(); } 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; } |
#owner(*args) ⇒ Object
24716 24717 24718 24719 24720 24721 24722 24723 24724 24725 24726 24727 24728 24729 24730 24731 24732 24733 24734 24735 24736 24737 24738 24739 24740 24741 24742 24743 24744 24745 24746 24747 24748 24749 24750 24751 24752 24753 24754 24755 24756 |
# File 'ext/cntk/cntk_wrap.cxx', line 24716 SWIGINTERN VALUE _wrap_Variable_owner(int argc, VALUE *argv, VALUE self) { CNTK::Variable *arg1 = (CNTK::Variable *) 0 ; void *argp1 = 0 ; int res1 = 0 ; CNTK::FunctionPtr 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__Variable, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Variable *","Owner", 1, self )); } arg1 = reinterpret_cast< CNTK::Variable * >(argp1); { try { result = (arg1)->Owner(); } 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"); } } { std::shared_ptr< CNTK::Function > *smartresult = result ? new std::shared_ptr< CNTK::Function >(result) : 0; vresult = SWIG_NewPointerObj(SWIG_as_voidptr(smartresult), SWIGTYPE_p_std__shared_ptrT_CNTK__Function_t, SWIG_POINTER_OWN); } return vresult; fail: return Qnil; } |
#reshape(shape) ⇒ Object
16 17 18 |
# File 'lib/cntk/variable.rb', line 16 def reshape(shape) Ops.reshape(self, shape) end |
#shape(*args) ⇒ Object
24276 24277 24278 24279 24280 24281 24282 24283 24284 24285 24286 24287 24288 24289 24290 24291 24292 24293 24294 24295 24296 24297 24298 24299 24300 24301 24302 24303 24304 24305 24306 24307 24308 24309 24310 24311 24312 24313 |
# File 'ext/cntk/cntk_wrap.cxx', line 24276 SWIGINTERN VALUE _wrap_Variable_shape(int argc, VALUE *argv, VALUE self) { CNTK::Variable *arg1 = (CNTK::Variable *) 0 ; void *argp1 = 0 ; int res1 = 0 ; CNTK::NDShape *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__Variable, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Variable *","Shape", 1, self )); } arg1 = reinterpret_cast< CNTK::Variable * >(argp1); { try { result = (CNTK::NDShape *) &(arg1)->Shape(); } 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__NDShape, 0 | 0 ); return vresult; fail: return Qnil; } |
#to_function(*args) ⇒ Object
24839 24840 24841 24842 24843 24844 24845 24846 24847 24848 24849 24850 24851 24852 24853 24854 24855 24856 24857 24858 24859 24860 24861 24862 24863 24864 24865 24866 24867 24868 24869 24870 24871 24872 24873 24874 24875 24876 24877 24878 24879 |
# File 'ext/cntk/cntk_wrap.cxx', line 24839 SWIGINTERN VALUE _wrap_Variable_to_function(int argc, VALUE *argv, VALUE self) { CNTK::Variable *arg1 = (CNTK::Variable *) 0 ; void *argp1 = 0 ; int res1 = 0 ; CNTK::FunctionPtr 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__Variable, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Variable *","to_function", 1, self )); } arg1 = reinterpret_cast< CNTK::Variable * >(argp1); { try { result = CNTK_Variable_to_function(arg1); } 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"); } } { std::shared_ptr< CNTK::Function > *smartresult = result ? new std::shared_ptr< CNTK::Function >(result) : 0; vresult = SWIG_NewPointerObj(SWIG_as_voidptr(smartresult), SWIGTYPE_p_std__shared_ptrT_CNTK__Function_t, SWIG_POINTER_OWN); } return vresult; fail: return Qnil; } |
#uid(*args) ⇒ Object
24676 24677 24678 24679 24680 24681 24682 24683 24684 24685 24686 24687 24688 24689 24690 24691 24692 24693 24694 24695 24696 24697 24698 24699 24700 24701 24702 24703 24704 24705 24706 24707 24708 24709 24710 24711 24712 24713 |
# File 'ext/cntk/cntk_wrap.cxx', line 24676 SWIGINTERN VALUE _wrap_Variable_uid(int argc, VALUE *argv, VALUE self) { CNTK::Variable *arg1 = (CNTK::Variable *) 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__Variable, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Variable *","Uid", 1, self )); } arg1 = reinterpret_cast< CNTK::Variable * >(argp1); { try { result = (std::wstring *) &(arg1)->Uid(); } 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; } |