Class: CNTK::Value
- Inherits:
-
Object
- Object
- CNTK::Value
- Includes:
- InspectUtil
- Defined in:
- lib/cntk/value.rb,
lib/cntk/inspect.rb,
ext/cntk/cntk_wrap.cxx
Class Method Summary collapse
- .__create__(*args, self) ⇒ Object
- .create(variable, data, seq_starts = [], device = DeviceDescriptor.use_default_device, read_only = false) ⇒ Object
Instance Method Summary collapse
- #alias(*args, self) ⇒ Object
- #copy_from(*args) ⇒ Object
- #copy_variable_value_to(*args) ⇒ Object
- #data(*args) ⇒ Object
- #deep_clone(*args, self) ⇒ Object
- #device(*args) ⇒ Object
- #get_data_type(*args) ⇒ Object
- #get_storage_format(*args) ⇒ Object
- #initialize(*args, self) ⇒ Object constructor
- #inspect ⇒ Object
- #is_read_only(*args) ⇒ Object
- #is_sparse(*args) ⇒ Object
- #mask(*args) ⇒ Object
- #masked_count(*args) ⇒ Object
- #reshape(a) ⇒ Object
- #shape(*args) ⇒ Object
- #to_narray ⇒ Object
Methods included from InspectUtil
#inspect_methods, #inspect_methods_p
Constructor Details
#initialize(*args, self) ⇒ Object
30058 30059 30060 30061 30062 30063 30064 30065 30066 30067 30068 30069 30070 30071 30072 30073 30074 30075 30076 30077 30078 30079 30080 30081 30082 30083 30084 30085 30086 30087 30088 30089 30090 30091 30092 30093 30094 30095 |
# File 'ext/cntk/cntk_wrap.cxx', line 30058 SWIGINTERN VALUE _wrap_new_Value(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_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__shared_ptrT_CNTK__NDArrayView_t, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_Value__SWIG_0(nargs, args, self); } } if (argc == 2) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__shared_ptrT_CNTK__NDArrayView_t, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_std__shared_ptrT_CNTK__NDMask_t, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_Value__SWIG_1(nargs, args, self); } } } fail: Ruby_Format_OverloadedError( argc, 2, "Value.new", " Value.new(CNTK::NDArrayViewPtr const &data)\n" " Value.new(CNTK::NDArrayViewPtr const &data, CNTK::NDMaskPtr const &mask)\n"); return Qnil; } |
Class Method Details
.__create__(*args, self) ⇒ Object
29843 29844 29845 29846 29847 29848 29849 29850 29851 29852 29853 29854 29855 29856 29857 29858 29859 29860 29861 29862 29863 29864 29865 29866 29867 29868 29869 29870 29871 29872 29873 29874 29875 29876 29877 29878 29879 29880 29881 29882 29883 29884 29885 29886 29887 29888 29889 29890 29891 29892 29893 29894 29895 29896 29897 29898 29899 29900 29901 29902 29903 29904 29905 29906 29907 29908 29909 29910 29911 29912 29913 29914 |
# File 'ext/cntk/cntk_wrap.cxx', line 29843 SWIGINTERN VALUE _wrap_Value___create__(int nargs, VALUE *args, VALUE self) { int argc; VALUE argv[5]; int ii; argc = nargs; if (argc > 5) SWIG_fail; for (ii = 0; (ii < argc); ++ii) { argv[ii] = args[ii]; } if (argc == 4) { 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::asptr(argv[1], (std::vector< std::shared_ptr< CNTK::NDArrayView >,std::allocator< std::shared_ptr< CNTK::NDArrayView > > >**)(0)); _v = SWIG_CheckState(res); if (_v) { int res = swig::asptr(argv[2], (std::vector<bool,std::allocator< bool > >**)(0)); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_CNTK__DeviceDescriptor, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_Value___create____SWIG_1(nargs, args, self); } } } } } if (argc == 5) { 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::asptr(argv[1], (std::vector< std::shared_ptr< CNTK::NDArrayView >,std::allocator< std::shared_ptr< CNTK::NDArrayView > > >**)(0)); _v = SWIG_CheckState(res); if (_v) { int res = swig::asptr(argv[2], (std::vector<bool,std::allocator< bool > >**)(0)); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_CNTK__DeviceDescriptor, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_bool(argv[4], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_Value___create____SWIG_0(nargs, args, self); } } } } } } fail: Ruby_Format_OverloadedError( argc, 5, "Value.__create__", " CNTK::ValuePtr Value.__create__(CNTK::NDShape const &sampleShape, std::vector< CNTK::NDArrayViewPtr,std::allocator< CNTK::NDArrayViewPtr > > const &sequences, std::vector< bool,std::allocator< bool > > const &sequenceStartFlags, CNTK::DeviceDescriptor const &device, bool readOnly)\n" " CNTK::ValuePtr Value.__create__(CNTK::NDShape const &sampleShape, std::vector< CNTK::NDArrayViewPtr,std::allocator< CNTK::NDArrayViewPtr > > const &sequences, std::vector< bool,std::allocator< bool > > const &sequenceStartFlags, CNTK::DeviceDescriptor const &device)\n"); return Qnil; } |
.create(variable, data, seq_starts = [], device = DeviceDescriptor.use_default_device, read_only = false) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/cntk/value.rb', line 4 def self.create(variable, data, seq_starts=[], device=DeviceDescriptor.use_default_device, read_only=false) if variable.dynamic_axes.size == 0 ndav = NDArrayView.new(data, DeviceDescriptor.cpudevice) new(ndav) else ndav = data.map{|a| NDArrayView.create(a) } __create__(variable.shape, ndav, seq_starts, device, read_only) end end |
Instance Method Details
#alias(*args, self) ⇒ Object
30830 30831 30832 30833 30834 30835 30836 30837 30838 30839 30840 30841 30842 30843 30844 30845 30846 30847 30848 30849 30850 30851 30852 30853 30854 30855 30856 30857 30858 30859 30860 30861 30862 30863 30864 30865 30866 30867 30868 30869 30870 |
# File 'ext/cntk/cntk_wrap.cxx', line 30830 SWIGINTERN VALUE _wrap_Value_alias(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; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__shared_ptrT_CNTK__Value_t, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_Value_alias__SWIG_1(nargs, args, self); } } if (argc == 2) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__shared_ptrT_CNTK__Value_t, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_bool(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_Value_alias__SWIG_0(nargs, args, self); } } } fail: Ruby_Format_OverloadedError( argc, 3, "Value.alias", " CNTK::ValuePtr Value.alias(bool readOnly)\n" " CNTK::ValuePtr Value.alias()\n"); return Qnil; } |
#copy_from(*args) ⇒ Object
30873 30874 30875 30876 30877 30878 30879 30880 30881 30882 30883 30884 30885 30886 30887 30888 30889 30890 30891 30892 30893 30894 30895 30896 30897 30898 30899 30900 30901 30902 30903 30904 30905 30906 30907 30908 30909 30910 30911 30912 30913 30914 30915 30916 30917 30918 30919 30920 30921 30922 30923 30924 30925 30926 30927 30928 30929 30930 30931 30932 30933 30934 30935 30936 30937 30938 30939 30940 30941 30942 30943 30944 |
# File 'ext/cntk/cntk_wrap.cxx', line 30873 SWIGINTERN VALUE _wrap_Value_copy_from(int argc, VALUE *argv, VALUE self) { CNTK::Value *arg1 = (CNTK::Value *) 0 ; CNTK::Value *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; std::shared_ptr< CNTK::Value > tempshared1 ; std::shared_ptr< CNTK::Value > *smartarg1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; std::shared_ptr< CNTK::Value const > tempshared2 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } { swig_ruby_owntype newmem = { 0, 0 }; res1 = SWIG_ConvertPtrAndOwn(self, &argp1, SWIGTYPE_p_std__shared_ptrT_CNTK__Value_t, 0 | 0 , &newmem); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Value *","CopyFrom", 1, self )); } if (newmem.own & SWIG_CAST_NEW_MEMORY) { tempshared1 = *reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); delete reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >(tempshared1.get()); } else { smartarg1 = reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >((smartarg1 ? smartarg1->get() : 0)); } } { swig_ruby_owntype newmem = { 0, 0 }; res2 = SWIG_ConvertPtrAndOwn(argv[0], &argp2, SWIGTYPE_p_std__shared_ptrT_CNTK__Value_t, 0 , &newmem); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "CNTK::Value const &","CopyFrom", 2, argv[0] )); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "CNTK::Value const &","CopyFrom", 2, argv[0])); } if (newmem.own & SWIG_CAST_NEW_MEMORY) { tempshared2 = *reinterpret_cast< std::shared_ptr< const CNTK::Value > * >(argp2); delete reinterpret_cast< std::shared_ptr< const CNTK::Value > * >(argp2); arg2 = const_cast< CNTK::Value * >(tempshared2.get()); } else { arg2 = const_cast< CNTK::Value * >(reinterpret_cast< std::shared_ptr< const CNTK::Value > * >(argp2)->get()); } } { try { (arg1)->CopyFrom((CNTK::Value 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"); } } return Qnil; fail: return Qnil; } |
#copy_variable_value_to(*args) ⇒ Object
30947 30948 30949 30950 30951 30952 30953 30954 30955 30956 30957 30958 30959 30960 30961 30962 30963 30964 30965 30966 30967 30968 30969 30970 30971 30972 30973 30974 30975 30976 30977 30978 30979 30980 30981 30982 30983 30984 30985 30986 30987 30988 30989 30990 30991 30992 30993 30994 30995 30996 30997 30998 30999 31000 31001 31002 31003 31004 31005 31006 31007 31008 31009 31010 31011 31012 31013 31014 31015 31016 31017 |
# File 'ext/cntk/cntk_wrap.cxx', line 30947 SWIGINTERN VALUE _wrap_Value_copy_variable_value_to(int argc, VALUE *argv, VALUE self) { CNTK::Value *arg1 = (CNTK::Value *) 0 ; CNTK::Variable *arg2 = 0 ; std::vector< std::vector< size_t,std::allocator< size_t > >,std::allocator< std::vector< size_t,std::allocator< size_t > > > > *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; std::shared_ptr< CNTK::Value > tempshared1 ; std::shared_ptr< CNTK::Value > *smartarg1 = 0 ; void *argp2 ; int res2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; if ((argc < 2) || (argc > 2)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; } { swig_ruby_owntype newmem = { 0, 0 }; res1 = SWIG_ConvertPtrAndOwn(self, &argp1, SWIGTYPE_p_std__shared_ptrT_CNTK__Value_t, 0 | 0 , &newmem); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Value *","CopyVariableValueTo", 1, self )); } if (newmem.own & SWIG_CAST_NEW_MEMORY) { tempshared1 = *reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); delete reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >(tempshared1.get()); } else { smartarg1 = reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >((smartarg1 ? smartarg1->get() : 0)); } } 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 &","CopyVariableValueTo", 2, argv[0] )); } if (!argp2) { SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "CNTK::Variable const &","CopyVariableValueTo", 2, argv[0])); } arg2 = reinterpret_cast< CNTK::Variable * >(argp2); res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_std__vectorT_std__vectorT_size_t_std__allocatorT_size_t_t_t_std__allocatorT_std__vectorT_size_t_std__allocatorT_size_t_t_t_t_t, 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::vector< std::vector< size_t,std::allocator< size_t > >,std::allocator< std::vector< size_t,std::allocator< size_t > > > > &","CopyVariableValueTo", 3, argv[1] )); } if (!argp3) { SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< std::vector< size_t,std::allocator< size_t > >,std::allocator< std::vector< size_t,std::allocator< size_t > > > > &","CopyVariableValueTo", 3, argv[1])); } arg3 = reinterpret_cast< std::vector< std::vector< size_t,std::allocator< size_t > >,std::allocator< std::vector< size_t,std::allocator< size_t > > > > * >(argp3); { try { (arg1)->CopyVariableValueTo((CNTK::Variable const &)*arg2,*arg3); } 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"); } } return Qnil; fail: return Qnil; } |
#data(*args) ⇒ Object
30429 30430 30431 30432 30433 30434 30435 30436 30437 30438 30439 30440 30441 30442 30443 30444 30445 30446 30447 30448 30449 30450 30451 30452 30453 30454 30455 30456 30457 30458 30459 30460 30461 30462 30463 30464 30465 30466 30467 30468 30469 30470 30471 30472 30473 30474 30475 30476 30477 30478 30479 30480 30481 30482 30483 |
# File 'ext/cntk/cntk_wrap.cxx', line 30429 SWIGINTERN VALUE _wrap_Value_data(int argc, VALUE *argv, VALUE self) { CNTK::Value *arg1 = (CNTK::Value *) 0 ; void *argp1 = 0 ; int res1 = 0 ; std::shared_ptr< CNTK::Value > tempshared1 ; std::shared_ptr< CNTK::Value > *smartarg1 = 0 ; CNTK::NDArrayViewPtr result; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } { swig_ruby_owntype newmem = { 0, 0 }; res1 = SWIG_ConvertPtrAndOwn(self, &argp1, SWIGTYPE_p_std__shared_ptrT_CNTK__Value_t, 0 | 0 , &newmem); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Value *","Data", 1, self )); } if (newmem.own & SWIG_CAST_NEW_MEMORY) { tempshared1 = *reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); delete reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >(tempshared1.get()); } else { smartarg1 = reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >((smartarg1 ? smartarg1->get() : 0)); } } { try { result = (arg1)->Data(); } 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::NDArrayView > *smartresult = result ? new std::shared_ptr< CNTK::NDArrayView >(result) : 0; vresult = SWIG_NewPointerObj(SWIG_as_voidptr(smartresult), SWIGTYPE_p_std__shared_ptrT_CNTK__NDArrayView_t, SWIG_POINTER_OWN); } return vresult; fail: return Qnil; } |
#deep_clone(*args, self) ⇒ Object
30665 30666 30667 30668 30669 30670 30671 30672 30673 30674 30675 30676 30677 30678 30679 30680 30681 30682 30683 30684 30685 30686 30687 30688 30689 30690 30691 30692 30693 30694 30695 30696 30697 30698 30699 30700 30701 30702 30703 30704 30705 |
# File 'ext/cntk/cntk_wrap.cxx', line 30665 SWIGINTERN VALUE _wrap_Value_deep_clone(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; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__shared_ptrT_CNTK__Value_t, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_Value_deep_clone__SWIG_1(nargs, args, self); } } if (argc == 2) { int _v; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__shared_ptrT_CNTK__Value_t, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_bool(argv[1], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_Value_deep_clone__SWIG_0(nargs, args, self); } } } fail: Ruby_Format_OverloadedError( argc, 3, "Value.deep_clone", " CNTK::ValuePtr Value.deep_clone(bool readOnly)\n" " CNTK::ValuePtr Value.deep_clone()\n"); return Qnil; } |
#device(*args) ⇒ Object
31020 31021 31022 31023 31024 31025 31026 31027 31028 31029 31030 31031 31032 31033 31034 31035 31036 31037 31038 31039 31040 31041 31042 31043 31044 31045 31046 31047 31048 31049 31050 31051 31052 31053 31054 31055 31056 31057 31058 31059 31060 31061 31062 31063 31064 31065 31066 31067 31068 31069 31070 31071 |
# File 'ext/cntk/cntk_wrap.cxx', line 31020 SWIGINTERN VALUE _wrap_Value_device(int argc, VALUE *argv, VALUE self) { CNTK::Value *arg1 = (CNTK::Value *) 0 ; void *argp1 = 0 ; int res1 = 0 ; std::shared_ptr< CNTK::Value > tempshared1 ; std::shared_ptr< CNTK::Value > *smartarg1 = 0 ; CNTK::DeviceDescriptor *result = 0 ; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } { swig_ruby_owntype newmem = { 0, 0 }; res1 = SWIG_ConvertPtrAndOwn(self, &argp1, SWIGTYPE_p_std__shared_ptrT_CNTK__Value_t, 0 | 0 , &newmem); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Value *","device", 1, self )); } if (newmem.own & SWIG_CAST_NEW_MEMORY) { tempshared1 = *reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); delete reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >(tempshared1.get()); } else { smartarg1 = reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >((smartarg1 ? smartarg1->get() : 0)); } } { try { result = (CNTK::DeviceDescriptor *)CNTK_Value_device(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"); } } vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CNTK__DeviceDescriptor, SWIG_POINTER_OWN | 0 ); return vresult; fail: return Qnil; } |
#get_data_type(*args) ⇒ Object
30105 30106 30107 30108 30109 30110 30111 30112 30113 30114 30115 30116 30117 30118 30119 30120 30121 30122 30123 30124 30125 30126 30127 30128 30129 30130 30131 30132 30133 30134 30135 30136 30137 30138 30139 30140 30141 30142 30143 30144 30145 30146 30147 30148 30149 30150 30151 30152 30153 30154 30155 30156 |
# File 'ext/cntk/cntk_wrap.cxx', line 30105 SWIGINTERN VALUE _wrap_Value_get_data_type(int argc, VALUE *argv, VALUE self) { CNTK::Value *arg1 = (CNTK::Value *) 0 ; void *argp1 = 0 ; int res1 = 0 ; std::shared_ptr< CNTK::Value > tempshared1 ; std::shared_ptr< CNTK::Value > *smartarg1 = 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; } { swig_ruby_owntype newmem = { 0, 0 }; res1 = SWIG_ConvertPtrAndOwn(self, &argp1, SWIGTYPE_p_std__shared_ptrT_CNTK__Value_t, 0 | 0 , &newmem); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Value *","GetDataType", 1, self )); } if (newmem.own & SWIG_CAST_NEW_MEMORY) { tempshared1 = *reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); delete reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >(tempshared1.get()); } else { smartarg1 = reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >((smartarg1 ? smartarg1->get() : 0)); } } { 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; } |
#get_storage_format(*args) ⇒ Object
30159 30160 30161 30162 30163 30164 30165 30166 30167 30168 30169 30170 30171 30172 30173 30174 30175 30176 30177 30178 30179 30180 30181 30182 30183 30184 30185 30186 30187 30188 30189 30190 30191 30192 30193 30194 30195 30196 30197 30198 30199 30200 30201 30202 30203 30204 30205 30206 30207 30208 30209 30210 |
# File 'ext/cntk/cntk_wrap.cxx', line 30159 SWIGINTERN VALUE _wrap_Value_get_storage_format(int argc, VALUE *argv, VALUE self) { CNTK::Value *arg1 = (CNTK::Value *) 0 ; void *argp1 = 0 ; int res1 = 0 ; std::shared_ptr< CNTK::Value > tempshared1 ; std::shared_ptr< CNTK::Value > *smartarg1 = 0 ; enum CNTK::StorageFormat result; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } { swig_ruby_owntype newmem = { 0, 0 }; res1 = SWIG_ConvertPtrAndOwn(self, &argp1, SWIGTYPE_p_std__shared_ptrT_CNTK__Value_t, 0 | 0 , &newmem); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Value *","GetStorageFormat", 1, self )); } if (newmem.own & SWIG_CAST_NEW_MEMORY) { tempshared1 = *reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); delete reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >(tempshared1.get()); } else { smartarg1 = reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >((smartarg1 ? smartarg1->get() : 0)); } } { try { result = (enum CNTK::StorageFormat)(arg1)->GetStorageFormat(); } 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; } |
#inspect ⇒ Object
36 37 38 |
# File 'lib/cntk/inspect.rb', line 36 def inspect inspect_methods([:shape]) end |
#is_read_only(*args) ⇒ Object
30321 30322 30323 30324 30325 30326 30327 30328 30329 30330 30331 30332 30333 30334 30335 30336 30337 30338 30339 30340 30341 30342 30343 30344 30345 30346 30347 30348 30349 30350 30351 30352 30353 30354 30355 30356 30357 30358 30359 30360 30361 30362 30363 30364 30365 30366 30367 30368 30369 30370 30371 30372 |
# File 'ext/cntk/cntk_wrap.cxx', line 30321 SWIGINTERN VALUE _wrap_Value_is_read_only(int argc, VALUE *argv, VALUE self) { CNTK::Value *arg1 = (CNTK::Value *) 0 ; void *argp1 = 0 ; int res1 = 0 ; std::shared_ptr< CNTK::Value > tempshared1 ; std::shared_ptr< CNTK::Value > *smartarg1 = 0 ; bool result; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } { swig_ruby_owntype newmem = { 0, 0 }; res1 = SWIG_ConvertPtrAndOwn(self, &argp1, SWIGTYPE_p_std__shared_ptrT_CNTK__Value_t, 0 | 0 , &newmem); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Value *","IsReadOnly", 1, self )); } if (newmem.own & SWIG_CAST_NEW_MEMORY) { tempshared1 = *reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); delete reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >(tempshared1.get()); } else { smartarg1 = reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >((smartarg1 ? smartarg1->get() : 0)); } } { try { result = (bool)(arg1)->IsReadOnly(); } 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_sparse(*args) ⇒ Object
30267 30268 30269 30270 30271 30272 30273 30274 30275 30276 30277 30278 30279 30280 30281 30282 30283 30284 30285 30286 30287 30288 30289 30290 30291 30292 30293 30294 30295 30296 30297 30298 30299 30300 30301 30302 30303 30304 30305 30306 30307 30308 30309 30310 30311 30312 30313 30314 30315 30316 30317 30318 |
# File 'ext/cntk/cntk_wrap.cxx', line 30267 SWIGINTERN VALUE _wrap_Value_is_sparse(int argc, VALUE *argv, VALUE self) { CNTK::Value *arg1 = (CNTK::Value *) 0 ; void *argp1 = 0 ; int res1 = 0 ; std::shared_ptr< CNTK::Value > tempshared1 ; std::shared_ptr< CNTK::Value > *smartarg1 = 0 ; bool result; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } { swig_ruby_owntype newmem = { 0, 0 }; res1 = SWIG_ConvertPtrAndOwn(self, &argp1, SWIGTYPE_p_std__shared_ptrT_CNTK__Value_t, 0 | 0 , &newmem); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Value *","IsSparse", 1, self )); } if (newmem.own & SWIG_CAST_NEW_MEMORY) { tempshared1 = *reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); delete reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >(tempshared1.get()); } else { smartarg1 = reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >((smartarg1 ? smartarg1->get() : 0)); } } { 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; } |
#mask(*args) ⇒ Object
30486 30487 30488 30489 30490 30491 30492 30493 30494 30495 30496 30497 30498 30499 30500 30501 30502 30503 30504 30505 30506 30507 30508 30509 30510 30511 30512 30513 30514 30515 30516 30517 30518 30519 30520 30521 30522 30523 30524 30525 30526 30527 30528 30529 30530 30531 30532 30533 30534 30535 30536 30537 30538 30539 30540 |
# File 'ext/cntk/cntk_wrap.cxx', line 30486 SWIGINTERN VALUE _wrap_Value_mask(int argc, VALUE *argv, VALUE self) { CNTK::Value *arg1 = (CNTK::Value *) 0 ; void *argp1 = 0 ; int res1 = 0 ; std::shared_ptr< CNTK::Value > tempshared1 ; std::shared_ptr< CNTK::Value > *smartarg1 = 0 ; CNTK::NDMaskPtr result; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } { swig_ruby_owntype newmem = { 0, 0 }; res1 = SWIG_ConvertPtrAndOwn(self, &argp1, SWIGTYPE_p_std__shared_ptrT_CNTK__Value_t, 0 | 0 , &newmem); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Value *","Mask", 1, self )); } if (newmem.own & SWIG_CAST_NEW_MEMORY) { tempshared1 = *reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); delete reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >(tempshared1.get()); } else { smartarg1 = reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >((smartarg1 ? smartarg1->get() : 0)); } } { try { result = (arg1)->Mask(); } 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::NDMask > *smartresult = result ? new std::shared_ptr< CNTK::NDMask >(result) : 0; vresult = SWIG_NewPointerObj(SWIG_as_voidptr(smartresult), SWIGTYPE_p_std__shared_ptrT_CNTK__NDMask_t, SWIG_POINTER_OWN); } return vresult; fail: return Qnil; } |
#masked_count(*args) ⇒ Object
30375 30376 30377 30378 30379 30380 30381 30382 30383 30384 30385 30386 30387 30388 30389 30390 30391 30392 30393 30394 30395 30396 30397 30398 30399 30400 30401 30402 30403 30404 30405 30406 30407 30408 30409 30410 30411 30412 30413 30414 30415 30416 30417 30418 30419 30420 30421 30422 30423 30424 30425 30426 |
# File 'ext/cntk/cntk_wrap.cxx', line 30375 SWIGINTERN VALUE _wrap_Value_masked_count(int argc, VALUE *argv, VALUE self) { CNTK::Value *arg1 = (CNTK::Value *) 0 ; void *argp1 = 0 ; int res1 = 0 ; std::shared_ptr< CNTK::Value > tempshared1 ; std::shared_ptr< CNTK::Value > *smartarg1 = 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; } { swig_ruby_owntype newmem = { 0, 0 }; res1 = SWIG_ConvertPtrAndOwn(self, &argp1, SWIGTYPE_p_std__shared_ptrT_CNTK__Value_t, 0 | 0 , &newmem); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Value *","MaskedCount", 1, self )); } if (newmem.own & SWIG_CAST_NEW_MEMORY) { tempshared1 = *reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); delete reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >(tempshared1.get()); } else { smartarg1 = reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >((smartarg1 ? smartarg1->get() : 0)); } } { try { result = (arg1)->MaskedCount(); } 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; } |
#reshape(a) ⇒ Object
18 19 20 21 |
# File 'lib/cntk/value.rb', line 18 def reshape(a) na = to_narray().reshape(*a) self.class.new(NDArrayView.create(na)) end |
#shape(*args) ⇒ Object
30213 30214 30215 30216 30217 30218 30219 30220 30221 30222 30223 30224 30225 30226 30227 30228 30229 30230 30231 30232 30233 30234 30235 30236 30237 30238 30239 30240 30241 30242 30243 30244 30245 30246 30247 30248 30249 30250 30251 30252 30253 30254 30255 30256 30257 30258 30259 30260 30261 30262 30263 30264 |
# File 'ext/cntk/cntk_wrap.cxx', line 30213 SWIGINTERN VALUE _wrap_Value_shape(int argc, VALUE *argv, VALUE self) { CNTK::Value *arg1 = (CNTK::Value *) 0 ; void *argp1 = 0 ; int res1 = 0 ; std::shared_ptr< CNTK::Value > tempshared1 ; std::shared_ptr< CNTK::Value > *smartarg1 = 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; } { swig_ruby_owntype newmem = { 0, 0 }; res1 = SWIG_ConvertPtrAndOwn(self, &argp1, SWIGTYPE_p_std__shared_ptrT_CNTK__Value_t, 0 | 0 , &newmem); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Value *","Shape", 1, self )); } if (newmem.own & SWIG_CAST_NEW_MEMORY) { tempshared1 = *reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); delete reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >(tempshared1.get()); } else { smartarg1 = reinterpret_cast< std::shared_ptr< CNTK::Value > * >(argp1); arg1 = const_cast< CNTK::Value * >((smartarg1 ? smartarg1->get() : 0)); } } { 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_narray ⇒ Object
14 15 16 |
# File 'lib/cntk/value.rb', line 14 def to_narray data().to_narray end |