Class: CNTK::MinibatchSource
- Inherits:
-
Object
- Object
- CNTK::MinibatchSource
- Defined in:
- lib/cntk/io.rb,
ext/cntk/cntk_wrap.cxx
Instance Method Summary collapse
- #get_checkpoint_state(*args) ⇒ Object
- #get_next_minibatch(*args, self) ⇒ Object
- #next_minibatch(minibatch_size_in_samples, device: DeviceDescriptor.use_default_device, num_data_partitions: 1, partition_index: 0) ⇒ MinibatchData
- #restore_from_checkpoint(*args) ⇒ Object
- #stream_info(*args, self) ⇒ Object
- #stream_infos(*args) ⇒ Object
Instance Method Details
#get_checkpoint_state(*args) ⇒ Object
61719 61720 61721 61722 61723 61724 61725 61726 61727 61728 61729 61730 61731 61732 61733 61734 61735 61736 61737 61738 61739 61740 61741 61742 61743 61744 61745 61746 61747 61748 61749 61750 61751 61752 61753 61754 61755 61756 61757 61758 61759 61760 61761 61762 61763 61764 61765 61766 61767 61768 61769 61770 |
# File 'ext/cntk/cntk_wrap.cxx', line 61719
SWIGINTERN VALUE
_wrap_MinibatchSource_get_checkpoint_state(int argc, VALUE *argv, VALUE self) {
CNTK::MinibatchSource *arg1 = (CNTK::MinibatchSource *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
std::shared_ptr< CNTK::MinibatchSource const > tempshared1 ;
std::shared_ptr< CNTK::MinibatchSource const > *smartarg1 = 0 ;
CNTK::Dictionary 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__MinibatchSource_t, 0 | 0 , &newmem);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::MinibatchSource const *","GetCheckpointState", 1, self ));
}
if (newmem.own & SWIG_CAST_NEW_MEMORY) {
tempshared1 = *reinterpret_cast< std::shared_ptr< const CNTK::MinibatchSource > * >(argp1);
delete reinterpret_cast< std::shared_ptr< const CNTK::MinibatchSource > * >(argp1);
arg1 = const_cast< CNTK::MinibatchSource * >(tempshared1.get());
} else {
smartarg1 = reinterpret_cast< std::shared_ptr< const CNTK::MinibatchSource > * >(argp1);
arg1 = const_cast< CNTK::MinibatchSource * >((smartarg1 ? smartarg1->get() : 0));
}
}
{
try {
result = ((CNTK::MinibatchSource const *)arg1)->GetCheckpointState();
}
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::Dictionary(static_cast< const CNTK::Dictionary& >(result))), SWIGTYPE_p_CNTK__Dictionary, SWIG_POINTER_OWN | 0 );
return vresult;
fail:
return Qnil;
}
|
#get_next_minibatch(*args, self) ⇒ Object
61547 61548 61549 61550 61551 61552 61553 61554 61555 61556 61557 61558 61559 61560 61561 61562 61563 61564 61565 61566 61567 61568 61569 61570 61571 61572 61573 61574 61575 61576 61577 61578 61579 61580 61581 61582 61583 61584 61585 61586 61587 61588 61589 61590 61591 61592 61593 61594 61595 61596 61597 61598 61599 61600 61601 61602 61603 61604 61605 61606 61607 61608 61609 61610 61611 61612 61613 61614 61615 61616 61617 61618 61619 61620 61621 61622 61623 61624 61625 61626 61627 61628 61629 61630 61631 61632 61633 61634 61635 61636 61637 61638 61639 61640 61641 61642 61643 61644 61645 61646 61647 61648 61649 61650 61651 61652 61653 61654 61655 61656 61657 61658 61659 61660 61661 61662 61663 61664 61665 61666 61667 61668 61669 61670 61671 61672 61673 61674 61675 61676 61677 61678 61679 61680 61681 61682 61683 61684 61685 61686 61687 61688 61689 61690 61691 61692 61693 61694 61695 61696 61697 61698 61699 61700 61701 61702 61703 61704 61705 61706 61707 61708 61709 61710 61711 61712 61713 61714 61715 61716 |
# File 'ext/cntk/cntk_wrap.cxx', line 61547
SWIGINTERN VALUE _wrap_MinibatchSource_get_next_minibatch(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[7];
int ii;
argc = nargs + 1;
argv[0] = self;
if (argc > 7) SWIG_fail;
for (ii = 1; (ii < argc); ++ii) {
argv[ii] = args[ii-1];
}
if (argc == 2) {
int _v;
int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__shared_ptrT_CNTK__MinibatchSource_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_size_t(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_MinibatchSource_get_next_minibatch__SWIG_1(nargs, args, self);
}
}
}
if (argc == 3) {
int _v;
int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__shared_ptrT_CNTK__MinibatchSource_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_size_t(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_CNTK__DeviceDescriptor, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_MinibatchSource_get_next_minibatch__SWIG_0(nargs, args, self);
}
}
}
}
if (argc == 3) {
int _v;
int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__shared_ptrT_CNTK__MinibatchSource_t, 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_MinibatchSource_get_next_minibatch__SWIG_3(nargs, args, self);
}
}
}
}
if (argc == 4) {
int _v;
int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__shared_ptrT_CNTK__MinibatchSource_t, 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) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_CNTK__DeviceDescriptor, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_MinibatchSource_get_next_minibatch__SWIG_2(nargs, args, self);
}
}
}
}
}
if (argc == 5) {
int _v;
int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__shared_ptrT_CNTK__MinibatchSource_t, 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) {
{
int res = SWIG_AsVal_size_t(argv[3], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
{
int res = SWIG_AsVal_size_t(argv[4], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_MinibatchSource_get_next_minibatch__SWIG_5(nargs, args, self);
}
}
}
}
}
}
if (argc == 6) {
int _v;
int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__shared_ptrT_CNTK__MinibatchSource_t, 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) {
{
int res = SWIG_AsVal_size_t(argv[3], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
{
int res = SWIG_AsVal_size_t(argv[4], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[5], &vptr, SWIGTYPE_p_CNTK__DeviceDescriptor, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_MinibatchSource_get_next_minibatch__SWIG_4(nargs, args, self);
}
}
}
}
}
}
}
fail:
Ruby_Format_OverloadedError( argc, 7, "MinibatchSource.get_next_minibatch",
" std::unordered_map< CNTK::StreamInformation,CNTK::MinibatchData,std::hash< CNTK::StreamInformation >,std::equal_to< CNTK::StreamInformation >,std::allocator< std::pair< CNTK::StreamInformation const,CNTK::MinibatchData > > > const MinibatchSource.get_next_minibatch(size_t minibatchSizeInSamples, CNTK::DeviceDescriptor const &device)\n"
" std::unordered_map< CNTK::StreamInformation,CNTK::MinibatchData,std::hash< CNTK::StreamInformation >,std::equal_to< CNTK::StreamInformation >,std::allocator< std::pair< CNTK::StreamInformation const,CNTK::MinibatchData > > > const MinibatchSource.get_next_minibatch(size_t minibatchSizeInSamples)\n"
" std::unordered_map< CNTK::StreamInformation,CNTK::MinibatchData,std::hash< CNTK::StreamInformation >,std::equal_to< CNTK::StreamInformation >,std::allocator< std::pair< CNTK::StreamInformation const,CNTK::MinibatchData > > > const MinibatchSource.get_next_minibatch(size_t minibatchSizeInSequences, size_t minibatchSizeInSamples, CNTK::DeviceDescriptor const &device)\n"
" std::unordered_map< CNTK::StreamInformation,CNTK::MinibatchData,std::hash< CNTK::StreamInformation >,std::equal_to< CNTK::StreamInformation >,std::allocator< std::pair< CNTK::StreamInformation const,CNTK::MinibatchData > > > const MinibatchSource.get_next_minibatch(size_t minibatchSizeInSequences, size_t minibatchSizeInSamples)\n"
" std::unordered_map< CNTK::StreamInformation,CNTK::MinibatchData,std::hash< CNTK::StreamInformation >,std::equal_to< CNTK::StreamInformation >,std::allocator< std::pair< CNTK::StreamInformation const,CNTK::MinibatchData > > > const MinibatchSource.get_next_minibatch(size_t minibatchSizeInSequences, size_t minibatchSizeInSamples, size_t numberOfWorkers, size_t workerRank, CNTK::DeviceDescriptor const &device)\n"
" std::unordered_map< CNTK::StreamInformation,CNTK::MinibatchData,std::hash< CNTK::StreamInformation >,std::equal_to< CNTK::StreamInformation >,std::allocator< std::pair< CNTK::StreamInformation const,CNTK::MinibatchData > > > const & MinibatchSource.get_next_minibatch(size_t minibatchSizeInSequences, size_t minibatchSizeInSamples, size_t numberOfWorkers, size_t workerRank)\n");
return Qnil;
}
|
#next_minibatch(minibatch_size_in_samples, device: DeviceDescriptor.use_default_device, num_data_partitions: 1, partition_index: 0) ⇒ MinibatchData
26 27 28 29 |
# File 'lib/cntk/io.rb', line 26 def next_minibatch(minibatch_size_in_samples, device: DeviceDescriptor.use_default_device, num_data_partitions: 1, partition_index: 0) get_next_minibatch(0, minibatch_size_in_samples, num_data_partitions, partition_index, device) end |
#restore_from_checkpoint(*args) ⇒ Object
61773 61774 61775 61776 61777 61778 61779 61780 61781 61782 61783 61784 61785 61786 61787 61788 61789 61790 61791 61792 61793 61794 61795 61796 61797 61798 61799 61800 61801 61802 61803 61804 61805 61806 61807 61808 61809 61810 61811 61812 61813 61814 61815 61816 61817 61818 61819 61820 61821 61822 61823 61824 61825 61826 61827 61828 61829 61830 61831 61832 |
# File 'ext/cntk/cntk_wrap.cxx', line 61773
SWIGINTERN VALUE
_wrap_MinibatchSource_restore_from_checkpoint(int argc, VALUE *argv, VALUE self) {
CNTK::MinibatchSource *arg1 = (CNTK::MinibatchSource *) 0 ;
CNTK::Dictionary *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
std::shared_ptr< CNTK::MinibatchSource > tempshared1 ;
std::shared_ptr< CNTK::MinibatchSource > *smartarg1 = 0 ;
void *argp2 ;
int res2 = 0 ;
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__MinibatchSource_t, 0 | 0 , &newmem);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::MinibatchSource *","RestoreFromCheckpoint", 1, self ));
}
if (newmem.own & SWIG_CAST_NEW_MEMORY) {
tempshared1 = *reinterpret_cast< std::shared_ptr< CNTK::MinibatchSource > * >(argp1);
delete reinterpret_cast< std::shared_ptr< CNTK::MinibatchSource > * >(argp1);
arg1 = const_cast< CNTK::MinibatchSource * >(tempshared1.get());
} else {
smartarg1 = reinterpret_cast< std::shared_ptr< CNTK::MinibatchSource > * >(argp1);
arg1 = const_cast< CNTK::MinibatchSource * >((smartarg1 ? smartarg1->get() : 0));
}
}
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CNTK__Dictionary, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "CNTK::Dictionary const &","RestoreFromCheckpoint", 2, argv[0] ));
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "CNTK::Dictionary const &","RestoreFromCheckpoint", 2, argv[0]));
}
arg2 = reinterpret_cast< CNTK::Dictionary * >(argp2);
{
try {
(arg1)->RestoreFromCheckpoint((CNTK::Dictionary 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;
}
|
#stream_info(*args, self) ⇒ Object
61969 61970 61971 61972 61973 61974 61975 61976 61977 61978 61979 61980 61981 61982 61983 61984 61985 61986 61987 61988 61989 61990 61991 61992 61993 61994 61995 61996 61997 61998 61999 62000 62001 62002 62003 62004 62005 62006 62007 62008 62009 62010 62011 62012 |
# File 'ext/cntk/cntk_wrap.cxx', line 61969
SWIGINTERN VALUE _wrap_MinibatchSource_stream_info(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 == 2) {
int _v;
int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__shared_ptrT_CNTK__MinibatchSource_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CNTK__Variable, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_MinibatchSource_stream_info__SWIG_1(nargs, args, self);
}
}
}
if (argc == 2) {
int _v;
int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__shared_ptrT_CNTK__MinibatchSource_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_MinibatchSource_stream_info__SWIG_0(nargs, args, self);
}
}
}
fail:
Ruby_Format_OverloadedError( argc, 3, "MinibatchSource.stream_info",
" CNTK::StreamInformation const MinibatchSource.stream_info(std::wstring const &streamName)\n"
" CNTK::StreamInformation const & MinibatchSource.stream_info(CNTK::Variable const &variableToMatch)\n");
return Qnil;
}
|
#stream_infos(*args) ⇒ Object
61024 61025 61026 61027 61028 61029 61030 61031 61032 61033 61034 61035 61036 61037 61038 61039 61040 61041 61042 61043 61044 61045 61046 61047 61048 61049 61050 61051 61052 61053 61054 61055 61056 61057 61058 61059 61060 61061 61062 61063 61064 61065 61066 61067 61068 61069 61070 61071 61072 61073 61074 61075 |
# File 'ext/cntk/cntk_wrap.cxx', line 61024
SWIGINTERN VALUE
_wrap_MinibatchSource_stream_infos(int argc, VALUE *argv, VALUE self) {
CNTK::MinibatchSource *arg1 = (CNTK::MinibatchSource *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
std::shared_ptr< CNTK::MinibatchSource > tempshared1 ;
std::shared_ptr< CNTK::MinibatchSource > *smartarg1 = 0 ;
std::unordered_set< CNTK::StreamInformation,std::hash< CNTK::StreamInformation >,std::equal_to< CNTK::StreamInformation >,std::allocator< CNTK::StreamInformation > > *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__MinibatchSource_t, 0 | 0 , &newmem);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::MinibatchSource *","StreamInfos", 1, self ));
}
if (newmem.own & SWIG_CAST_NEW_MEMORY) {
tempshared1 = *reinterpret_cast< std::shared_ptr< CNTK::MinibatchSource > * >(argp1);
delete reinterpret_cast< std::shared_ptr< CNTK::MinibatchSource > * >(argp1);
arg1 = const_cast< CNTK::MinibatchSource * >(tempshared1.get());
} else {
smartarg1 = reinterpret_cast< std::shared_ptr< CNTK::MinibatchSource > * >(argp1);
arg1 = const_cast< CNTK::MinibatchSource * >((smartarg1 ? smartarg1->get() : 0));
}
}
{
try {
result = (std::unordered_set< CNTK::StreamInformation,std::hash< CNTK::StreamInformation >,std::equal_to< CNTK::StreamInformation >,std::allocator< CNTK::StreamInformation > > *) &(arg1)->StreamInfos();
}
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_std__unordered_setT_CNTK__StreamInformation_std__hashT_CNTK__StreamInformation_t_std__equal_toT_CNTK__StreamInformation_t_std__allocatorT_CNTK__StreamInformation_t_t, 0 | 0 );
return vresult;
fail:
return Qnil;
}
|