Class: CNTK::Parameter
- Inherits:
-
((swig_class *) SWIGTYPE_p_CNTK__Variable->clientdata)->klass
- Object
- ((swig_class *) SWIGTYPE_p_CNTK__Variable->clientdata)->klass
- CNTK::Parameter
- Extended by:
- VariableExtend
- Defined in:
- lib/cntk/variable.rb,
ext/cntk/cntk_wrap.cxx
Overview
< Variable
Class Method Summary collapse
Instance Method Summary collapse
- #current_value_time_stamp(*args) ⇒ Object
- #initialize(*args, self) ⇒ Object constructor
- #record_value_update(*args) ⇒ Object
- #set_value(*args) ⇒ Object
- #value(*args) ⇒ Object
Methods included from VariableExtend
Constructor Details
#initialize(*args, self) ⇒ Object
28491 28492 28493 28494 28495 28496 28497 28498 28499 28500 28501 28502 28503 28504 28505 28506 28507 28508 28509 28510 28511 28512 28513 28514 28515 28516 28517 28518 28519 28520 28521 28522 28523 28524 28525 28526 28527 28528 28529 28530 28531 28532 28533 28534 28535 28536 28537 28538 28539 28540 28541 28542 28543 28544 28545 28546 28547 28548 28549 28550 28551 28552 28553 28554 28555 28556 28557 28558 28559 28560 28561 28562 28563 28564 28565 28566 28567 28568 28569 28570 28571 28572 28573 28574 28575 28576 28577 28578 28579 28580 28581 28582 28583 28584 28585 28586 28587 28588 28589 28590 28591 28592 28593 28594 28595 28596 28597 28598 28599 28600 28601 28602 28603 28604 28605 28606 28607 28608 28609 28610 28611 28612 28613 28614 28615 28616 28617 28618 28619 28620 28621 28622 28623 28624 28625 28626 28627 28628 28629 28630 28631 28632 28633 28634 28635 28636 28637 28638 28639 28640 28641 28642 28643 28644 28645 28646 28647 28648 28649 28650 28651 28652 28653 28654 28655 28656 28657 28658 28659 28660 28661 28662 28663 28664 28665 28666 28667 28668 28669 28670 28671 28672 28673 28674 28675 28676 28677 28678 28679 28680 28681 28682 28683 28684 28685 28686 28687 28688 28689 28690 28691 28692 28693 28694 28695 28696 28697 28698 28699 28700 28701 28702 28703 28704 28705 28706 28707 |
# File 'ext/cntk/cntk_wrap.cxx', line 28491
SWIGINTERN VALUE _wrap_new_Parameter(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 == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CNTK__Variable, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_Parameter__SWIG_0(nargs, args, self);
}
}
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_Parameter__SWIG_2(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_AsPtr_std_wstring(argv[1], (std::wstring**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_Parameter__SWIG_1(nargs, args, self);
}
}
}
if (argc == 3) {
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_int(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_CNTK__Dictionary, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_Parameter__SWIG_8(nargs, args, self);
}
}
}
}
if (argc == 3) {
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_int(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
{
int res = SWIG_AsVal_double(argv[2], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_new_Parameter__SWIG_5(nargs, args, self);
}
}
}
}
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_AsVal_int(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_CNTK__Dictionary, 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_new_Parameter__SWIG_7(nargs, args, self);
}
}
}
}
}
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_AsVal_int(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
{
int res = SWIG_AsVal_double(argv[2], NULL);
_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_new_Parameter__SWIG_4(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_AsVal_int(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_CNTK__Dictionary, 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_AsPtr_std_wstring(argv[4], (std::wstring**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_Parameter__SWIG_6(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_AsVal_int(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
{
int res = SWIG_AsVal_double(argv[2], NULL);
_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_AsPtr_std_wstring(argv[4], (std::wstring**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_Parameter__SWIG_3(nargs, args, self);
}
}
}
}
}
}
fail:
Ruby_Format_OverloadedError( argc, 5, "Parameter.new",
" Parameter.new(CNTK::Variable const &variable)\n"
" Parameter.new(CNTK::NDArrayViewPtr const &value, std::wstring const &name)\n"
" Parameter.new(CNTK::NDArrayViewPtr const &value)\n"
" Parameter.new(CNTK::NDShape const &shape, enum CNTK::DataType dataType, double initValue, CNTK::DeviceDescriptor const &device, std::wstring const &name)\n"
" Parameter.new(CNTK::NDShape const &shape, enum CNTK::DataType dataType, double initValue, CNTK::DeviceDescriptor const &device)\n"
" Parameter.new(CNTK::NDShape const &shape, enum CNTK::DataType dataType, double initValue)\n"
" Parameter.new(CNTK::NDShape const &shape, enum CNTK::DataType dataType, CNTK::Dictionary const &initializer, CNTK::DeviceDescriptor const &device, std::wstring const &name)\n"
" Parameter.new(CNTK::NDShape const &shape, enum CNTK::DataType dataType, CNTK::Dictionary const &initializer, CNTK::DeviceDescriptor const &device)\n"
" Parameter.new(CNTK::NDShape const &shape, enum CNTK::DataType dataType, CNTK::Dictionary const &initializer)\n");
return Qnil;
}
|
Class Method Details
.create(shape: nil, init: 0, dtype: DataType_Float, device: DeviceDescriptor::use_default_device(), name: "") ⇒ Object
104 105 106 |
# File 'lib/cntk/variable.rb', line 104 def self.create(shape: nil, init: 0, dtype: DataType_Float, device: DeviceDescriptor::use_default_device(), name: "") create_from(init, shape, dtype, device, name) end |
Instance Method Details
#current_value_time_stamp(*args) ⇒ Object
28716 28717 28718 28719 28720 28721 28722 28723 28724 28725 28726 28727 28728 28729 28730 28731 28732 28733 28734 28735 28736 28737 28738 28739 28740 28741 28742 28743 28744 28745 28746 28747 28748 28749 28750 28751 28752 28753 |
# File 'ext/cntk/cntk_wrap.cxx', line 28716
SWIGINTERN VALUE
_wrap_Parameter_current_value_time_stamp(int argc, VALUE *argv, VALUE self) {
CNTK::Parameter *arg1 = (CNTK::Parameter *) 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__Parameter, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Parameter *","CurrentValueTimeStamp", 1, self ));
}
arg1 = reinterpret_cast< CNTK::Parameter * >(argp1);
{
try {
result = (arg1)->CurrentValueTimeStamp();
}
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;
}
|
#record_value_update(*args) ⇒ Object
28756 28757 28758 28759 28760 28761 28762 28763 28764 28765 28766 28767 28768 28769 28770 28771 28772 28773 28774 28775 28776 28777 28778 28779 28780 28781 28782 28783 28784 28785 28786 28787 28788 28789 28790 |
# File 'ext/cntk/cntk_wrap.cxx', line 28756
SWIGINTERN VALUE
_wrap_Parameter_record_value_update(int argc, VALUE *argv, VALUE self) {
CNTK::Parameter *arg1 = (CNTK::Parameter *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
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__Parameter, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Parameter *","RecordValueUpdate", 1, self ));
}
arg1 = reinterpret_cast< CNTK::Parameter * >(argp1);
{
try {
(arg1)->RecordValueUpdate();
}
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;
}
|
#set_value(*args) ⇒ Object
28836 28837 28838 28839 28840 28841 28842 28843 28844 28845 28846 28847 28848 28849 28850 28851 28852 28853 28854 28855 28856 28857 28858 28859 28860 28861 28862 28863 28864 28865 28866 28867 28868 28869 28870 28871 28872 28873 28874 28875 28876 28877 28878 28879 28880 28881 28882 28883 28884 28885 28886 28887 28888 28889 28890 |
# File 'ext/cntk/cntk_wrap.cxx', line 28836
SWIGINTERN VALUE
_wrap_Parameter_set_value(int argc, VALUE *argv, VALUE self) {
CNTK::Parameter *arg1 = (CNTK::Parameter *) 0 ;
CNTK::NDArrayViewPtr *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
CNTK::NDArrayViewPtr tempshared2 ;
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__Parameter, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Parameter *","SetValue", 1, self ));
}
arg1 = reinterpret_cast< CNTK::Parameter * >(argp1);
{
swig_ruby_owntype newmem = {
0, 0
};
res2 = SWIG_ConvertPtrAndOwn(argv[0], &argp2, SWIGTYPE_p_std__shared_ptrT_CNTK__NDArrayView_t, 0 , &newmem);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "CNTK::NDArrayViewPtr const &","SetValue", 2, argv[0] ));
}
if (newmem.own & SWIG_CAST_NEW_MEMORY) {
if (argp2) tempshared2 = *reinterpret_cast< CNTK::NDArrayViewPtr * >(argp2);
delete reinterpret_cast< CNTK::NDArrayViewPtr * >(argp2);
arg2 = &tempshared2;
} else {
arg2 = (argp2) ? reinterpret_cast< CNTK::NDArrayViewPtr * >(argp2) : &tempshared2;
}
}
{
try {
(arg1)->SetValue((CNTK::NDArrayViewPtr 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;
}
|
#value(*args) ⇒ Object
28793 28794 28795 28796 28797 28798 28799 28800 28801 28802 28803 28804 28805 28806 28807 28808 28809 28810 28811 28812 28813 28814 28815 28816 28817 28818 28819 28820 28821 28822 28823 28824 28825 28826 28827 28828 28829 28830 28831 28832 28833 |
# File 'ext/cntk/cntk_wrap.cxx', line 28793
SWIGINTERN VALUE
_wrap_Parameter_value(int argc, VALUE *argv, VALUE self) {
CNTK::Parameter *arg1 = (CNTK::Parameter *) 0 ;
void *argp1 = 0 ;
int res1 = 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;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CNTK__Parameter, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::Parameter *","Value", 1, self ));
}
arg1 = reinterpret_cast< CNTK::Parameter * >(argp1);
{
try {
result = (arg1)->Value();
}
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;
}
|