fix leftover from rebase

consolidate C#/Java bindings

use capital letters as macro names; consolidate java/c# bindings; format changes
This commit is contained in:
Zhou Wang 2017-05-16 16:48:37 +02:00
Родитель 97289654e1
Коммит 6962df5175
3 изменённых файлов: 469 добавлений и 521 удалений

Просмотреть файл

@ -23,37 +23,6 @@
%include <arrays_csharp.i>
#endif
//use when the wrapped method returns an idiomatic type
//for non-idiomatic types, such as the default collection wrappers use RENAME_AND_MAKE_PRIVATE below
//and then write custom method in the language specific file
%define MAKE_GETTER(namespace, method)
%rename
#if defined(SWIGCSHARP)
(Get ## method)
#else
(get ## method)
#endif
namespace##::##method
%enddef
%define RENAME_AND_MAKE_PRIVATE(namespace, method)
#if defined(SWIGCSHARP)
%csmethodmodifiers
#else
%javamethodmodifiers
#endif
namespace##::##method "private";
%rename (_##method) namespace##::##method
%enddef
#ifdef SWIGCSHARP
#define %make_private(x) %csmethodmodifiers x "private"
%define %rename_and_make_private(namespace, method)
%csmethodmodifiers namespace##::##method "private";
%rename (_##method) namespace##::##method
%enddef
#endif
%{
#include "CNTKLibrary.h"
#pragma warning(disable : 4100) //unreferenced formal parameter
@ -101,29 +70,29 @@ SWIG_STD_VECTOR_ENHANCED(CNTK::DeviceDescriptor)
%template(FunctionPtrVector) std::vector<std::shared_ptr<CNTK::Function>>;
// ignore items not needed.
#define %ignore_function %rename("$ignore", %$isfunction, fullname=1)
#define %ignore_class %rename("$ignore", %$isclass, fullname=1)
#define %ignore_namespace %rename("$ignore", %$isnamespace, fullname=1)
#define %ignore_variable %rename("$ignore", %$isvariable, fullname=1)
#define IGNORE_FUNCTION %rename("$ignore", %$isfunction, fullname=1)
#define IGNORE_CLASS %rename("$ignore", %$isclass, fullname=1)
#define IGNORE_NAMESPACE %rename("$ignore", %$isnamespace, fullname=1)
#define IGNORE_VARIABLE %rename("$ignore", %$isvariable, fullname=1)
// It seems that SWIG does not understand %$isstruct.
#define %ignore_struct %rename("$ignore", fullname=1)
#define %ignore_enum_class %rename("$ignore", fullname=1)
#define IGNORE_STRUCT %rename("$ignore", fullname=1)
#define IGNORE_ENUM_CLASS %rename("$ignore", fullname=1)
%ignore_function CNTK::PlaceholderVariable;
%ignore_function CNTK::InputVariable;
%ignore_function CNTK::OutputVariable;
IGNORE_FUNCTION CNTK::PlaceholderVariable;
IGNORE_FUNCTION CNTK::InputVariable;
IGNORE_FUNCTION CNTK::OutputVariable;
%ignore_class CNTK::Variable::CompositeFunction;
%ignore_class CNTK::Variable::Trainer;
%ignore_class CNTK::Varaiable::PrimitiveFunction;
IGNORE_CLASS CNTK::Variable::CompositeFunction;
IGNORE_CLASS CNTK::Variable::Trainer;
IGNORE_CLASS CNTK::Varaiable::PrimitiveFunction;
%ignore_class CNTK::IDictionarySerializable;
%ignore_class CNTK::DictionaryValue;
IGNORE_CLASS CNTK::IDictionarySerializable;
IGNORE_CLASS CNTK::DictionaryValue;
// To suppress SWIG warning 302: Identifier redefined.
%ignore CNTK::DictionaryValue::operator=;
%ignore CNTK::DictionaryValue::Value;
%ignore_class CNTK::Dictionary;
%ignore_class CNTK::ParameterInitializer;
IGNORE_CLASS CNTK::Dictionary;
IGNORE_CLASS CNTK::ParameterInitializer;
%ignore CNTK::SentinelValueForAutoSelectRandomSeed;
%ignore CNTK::SentinelValueForInferParamInitRank;
@ -132,289 +101,313 @@ SWIG_STD_VECTOR_ENHANCED(CNTK::DeviceDescriptor)
%ignore CNTK::DefaultParamInitFilterRank;
%ignore CNTK::TimesNoInferredInputRank;
%ignore CNTK::TimesReduceSequenceAxisWithoutInferredInputRank;
%ignore_function CNTK::ConstantInitializer;
%ignore_function CNTK::UniformInitializer;
%ignore_function CNTK::NormalInitializer;
%ignore_function CNTK::XavierInitializer;
%ignore_function CNTK::GlorotUniformInitializer;
%ignore_function CNTK::GlorotNormalInitializer;
%ignore_function CNTK::HeUniformInitializer;
%ignore_function CNTK::HeNormalInitializer;
%ignore_function CNTK::BilinearInitializer;
%ignore_function CNTK::RandomInitializerWithRank;
%ignore_function CNTK::TruncatedNormalInitializer;
IGNORE_FUNCTION CNTK::ConstantInitializer;
IGNORE_FUNCTION CNTK::UniformInitializer;
IGNORE_FUNCTION CNTK::NormalInitializer;
IGNORE_FUNCTION CNTK::XavierInitializer;
IGNORE_FUNCTION CNTK::GlorotUniformInitializer;
IGNORE_FUNCTION CNTK::GlorotNormalInitializer;
IGNORE_FUNCTION CNTK::HeUniformInitializer;
IGNORE_FUNCTION CNTK::HeNormalInitializer;
IGNORE_FUNCTION CNTK::BilinearInitializer;
IGNORE_FUNCTION CNTK::RandomInitializerWithRank;
IGNORE_FUNCTION CNTK::TruncatedNormalInitializer;
%ignore std::hash<CNTK::Parameter>;
%ignore_struct std::hash<::CNTK::Constant>;
%ignore_struct std::hash<::CNTK::Axis>;
%ignore_struct std::hash<::CNTK::NDShape>;
%ignore_struct std::hash<::CNTK::Variable>;
IGNORE_STRUCT std::hash<::CNTK::Constant>;
IGNORE_STRUCT std::hash<::CNTK::Axis>;
IGNORE_STRUCT std::hash<::CNTK::NDShape>;
IGNORE_STRUCT std::hash<::CNTK::Variable>;
%ignore_function CNTK::Value::UnpackVariableValue;
IGNORE_FUNCTION CNTK::Value::UnpackVariableValue;
%ignore_class CNTK::Function::CompositeFunction;
%ignore_class CNTK::Function::Trainer;
IGNORE_CLASS CNTK::Function::CompositeFunction;
IGNORE_CLASS CNTK::Function::Trainer;
%ignore_function CNTK::Function::Backward;
%ignore_function CNTK::Function::Forward;
%ignore_function CNTK::Function::Serialize;
%ignore_function CNTK::Function::Deserialize;
%ignore_function CNTK::Function::Parameters;
%ignore_function CNTK::Function::Constants;
%ignore_function CNTK::Function::Placeholders;
%ignore_function CNTK::Function::Attributes;
%ignore_function CNTK::Function::PrintGraph;
%ignore_function CNTK::Function::BlockArgumentsMapping;
%ignore_function CNTK::Function::ReplacePlaceholders;
%ignore_function CNTK::Function::ReplacePlaceholder;
%ignore_function CNTK::Function::Function;
%ignore_function CNTK::Function::RestoreFromCheckpoint;
%ignore_function CNTK::Function::Gradients;
%ignore_function CNTK::Function::RegisterNativeUserFunction;
%ignore_function CNTK::Function::NativeUserFunction;
%ignore_function CNTK::Function::SetAttribute;
IGNORE_FUNCTION CNTK::Function::Backward;
IGNORE_FUNCTION CNTK::Function::Forward;
IGNORE_FUNCTION CNTK::Function::Serialize;
IGNORE_FUNCTION CNTK::Function::Deserialize;
IGNORE_FUNCTION CNTK::Function::Parameters;
IGNORE_FUNCTION CNTK::Function::Constants;
IGNORE_FUNCTION CNTK::Function::Placeholders;
IGNORE_FUNCTION CNTK::Function::Attributes;
IGNORE_FUNCTION CNTK::Function::PrintGraph;
IGNORE_FUNCTION CNTK::Function::BlockArgumentsMapping;
IGNORE_FUNCTION CNTK::Function::ReplacePlaceholders;
IGNORE_FUNCTION CNTK::Function::ReplacePlaceholder;
IGNORE_FUNCTION CNTK::Function::Function;
IGNORE_FUNCTION CNTK::Function::RestoreFromCheckpoint;
IGNORE_FUNCTION CNTK::Function::Gradients;
IGNORE_FUNCTION CNTK::Function::RegisterNativeUserFunction;
IGNORE_FUNCTION CNTK::Function::NativeUserFunction;
IGNORE_FUNCTION CNTK::Function::SetAttribute;
%ignore_class CNTK::Parameter;
%ignore_class CNTK::Constant;
%ignore_class CNTK::BackPropState;
%ignore_enum_class CNTK::PoolingType;
IGNORE_CLASS CNTK::Parameter;
IGNORE_CLASS CNTK::Constant;
IGNORE_CLASS CNTK::BackPropState;
IGNORE_ENUM_CLASS CNTK::PoolingType;
%ignore_function CNTK::Negate;
%ignore_function CNTK::operator-;
%ignore_function CNTK::Sigmoid;
%ignore_function CNTK::Tanh;
%ignore_function CNTK::Sin;
%ignore_function CNTK::Cos;
%ignore_function CNTK::ReLU;
%ignore_function CNTK::Exp;
%ignore_function CNTK::Log;
%ignore_function CNTK::Square;
%ignore_function CNTK::Sqrt;
%ignore_function CNTK::Round;
%ignore_function CNTK::Floor;
%ignore_function CNTK::Ceil;
%ignore_function CNTK::Abs;
%ignore_function CNTK::Reciprocal;
%ignore_function CNTK::Softmax;
%ignore_function CNTK::Hardmax;
%ignore_function CNTK::TransposeAxes;
%ignore_function CNTK::Transpose;
%ignore_function CNTK::Slice;
%ignore_function CNTK::RandomSample;
%ignore_function CNTK::RandomSampleInclusionFrequency;
%ignore_function CNTK::Dropout;
%ignore_function CNTK::Reshape;
%ignore_function CNTK::Plus;
%ignore_function CNTK::operator+;
%ignore_function CNTK::Minus;
%ignore_function CNTK::operator-;
%ignore_function CNTK::LogAddExp;
%ignore_function CNTK::Pow;
%ignore_function CNTK::ElementTimes;
%ignore_function CNTK::ElementDivide;
%ignore_function CNTK::Equal;
%ignore_function CNTK::NotEqual;
%ignore_function CNTK::Less;
%ignore_function CNTK::LessEqual;
%ignore_function CNTK::Greater;
%ignore_function CNTK::GreaterEqual;
%ignore_function CNTK::Times;
%ignore_function CNTK::TransposeTimes;
%ignore_function CNTK::CosineDistance;
%ignore_function CNTK::CosineDistanceWithNegativeSamples;
%ignore_function CNTK::BinaryCrossEntropy;
%ignore_function CNTK::WeightedBinaryCrossEntropy;
%ignore_function CNTK::SquaredError;
%ignore_function CNTK::CrossEntropyWithSoftmax;
%ignore_function CNTK::EditDistanceError;
%ignore_function CNTK::ForwardBackward;
%ignore_function CNTK::LabelsToGraph;
%ignore_function CNTK::ClassificationError;
%ignore_function CNTK::PastValue;
%ignore_function CNTK::FutureValue;
%ignore_function CNTK::ReduceSum;
%ignore_function CNTK::ReduceLogSum;
%ignore_function CNTK::ReduceMean;
%ignore_function CNTK::ReduceMax;
%ignore_function CNTK::ReduceMin;
%ignore_function CNTK::ReduceProd;
%ignore_function CNTK::PerDimMeanVarianceNormalize;
%ignore_function CNTK::Convolution;
%ignore_function CNTK::ROIPooling;
%ignore_function CNTK::ConvolutionTranspose;
%ignore_function CNTK::Pooling;
%ignore_function CNTK::Unpooling;
%ignore_function CNTK::LambdaRank;
%ignore_function CNTK::NDCGAt1;
%ignore_function CNTK::BatchNormalization;
%ignore_function CNTK::OptimizedRNNStack;
%ignore_function CNTK::Clip;
%ignore_function CNTK::ElementSelect;
%ignore_function CNTK::Splice;
%ignore_function CNTK::StopGradient;
%ignore_function CNTK::Assign;
%ignore_function CNTK::ELU;
%ignore_function CNTK::LeakyReLU;
%ignore_function CNTK::PReLU;
%ignore_function CNTK::Softplus;
%ignore_function CNTK::Argmax;
%ignore_function CNTK::Argmin;
%ignore_function CNTK::ToSequence;
%ignore_function CNTK::ToSequenceLike;
%ignore_function CNTK::AsBlock;
%ignore_function CNTK::ReaderCrop;
%ignore_function CNTK::ReaderMean;
%ignore_function CNTK::ReaderScale;
%ignore_function CNTK::ReaderColor;
%ignore_function CNTK::ImageDeserializer;
%ignore_function CNTK::Base64ImageDeserializer;
%ignore_function CNTK::CTFDeserializer;
%ignore_function CNTK::HTKFeatureDeserializer;
%ignore_function CNTK::HTKMLFDeserializer;
IGNORE_FUNCTION CNTK::Negate;
IGNORE_FUNCTION CNTK::operator-;
IGNORE_FUNCTION CNTK::Sigmoid;
IGNORE_FUNCTION CNTK::Tanh;
IGNORE_FUNCTION CNTK::Sin;
IGNORE_FUNCTION CNTK::Cos;
IGNORE_FUNCTION CNTK::ReLU;
IGNORE_FUNCTION CNTK::Exp;
IGNORE_FUNCTION CNTK::Log;
IGNORE_FUNCTION CNTK::Square;
IGNORE_FUNCTION CNTK::Sqrt;
IGNORE_FUNCTION CNTK::Round;
IGNORE_FUNCTION CNTK::Floor;
IGNORE_FUNCTION CNTK::Ceil;
IGNORE_FUNCTION CNTK::Abs;
IGNORE_FUNCTION CNTK::Reciprocal;
IGNORE_FUNCTION CNTK::Softmax;
IGNORE_FUNCTION CNTK::Hardmax;
IGNORE_FUNCTION CNTK::TransposeAxes;
IGNORE_FUNCTION CNTK::Transpose;
IGNORE_FUNCTION CNTK::Slice;
IGNORE_FUNCTION CNTK::RandomSample;
IGNORE_FUNCTION CNTK::RandomSampleInclusionFrequency;
IGNORE_FUNCTION CNTK::Dropout;
IGNORE_FUNCTION CNTK::Reshape;
IGNORE_FUNCTION CNTK::Plus;
IGNORE_FUNCTION CNTK::operator+;
IGNORE_FUNCTION CNTK::Minus;
IGNORE_FUNCTION CNTK::operator-;
IGNORE_FUNCTION CNTK::LogAddExp;
IGNORE_FUNCTION CNTK::Pow;
IGNORE_FUNCTION CNTK::ElementTimes;
IGNORE_FUNCTION CNTK::ElementDivide;
IGNORE_FUNCTION CNTK::Equal;
IGNORE_FUNCTION CNTK::NotEqual;
IGNORE_FUNCTION CNTK::Less;
IGNORE_FUNCTION CNTK::LessEqual;
IGNORE_FUNCTION CNTK::Greater;
IGNORE_FUNCTION CNTK::GreaterEqual;
IGNORE_FUNCTION CNTK::Times;
IGNORE_FUNCTION CNTK::TransposeTimes;
IGNORE_FUNCTION CNTK::CosineDistance;
IGNORE_FUNCTION CNTK::CosineDistanceWithNegativeSamples;
IGNORE_FUNCTION CNTK::BinaryCrossEntropy;
IGNORE_FUNCTION CNTK::WeightedBinaryCrossEntropy;
IGNORE_FUNCTION CNTK::SquaredError;
IGNORE_FUNCTION CNTK::CrossEntropyWithSoftmax;
IGNORE_FUNCTION CNTK::EditDistanceError;
IGNORE_FUNCTION CNTK::ForwardBackward;
IGNORE_FUNCTION CNTK::LabelsToGraph;
IGNORE_FUNCTION CNTK::ClassificationError;
IGNORE_FUNCTION CNTK::PastValue;
IGNORE_FUNCTION CNTK::FutureValue;
IGNORE_FUNCTION CNTK::ReduceSum;
IGNORE_FUNCTION CNTK::ReduceLogSum;
IGNORE_FUNCTION CNTK::ReduceMean;
IGNORE_FUNCTION CNTK::ReduceMax;
IGNORE_FUNCTION CNTK::ReduceMin;
IGNORE_FUNCTION CNTK::ReduceProd;
IGNORE_FUNCTION CNTK::PerDimMeanVarianceNormalize;
IGNORE_FUNCTION CNTK::Convolution;
IGNORE_FUNCTION CNTK::ROIPooling;
IGNORE_FUNCTION CNTK::ConvolutionTranspose;
IGNORE_FUNCTION CNTK::Pooling;
IGNORE_FUNCTION CNTK::Unpooling;
IGNORE_FUNCTION CNTK::LambdaRank;
IGNORE_FUNCTION CNTK::NDCGAt1;
IGNORE_FUNCTION CNTK::BatchNormalization;
IGNORE_FUNCTION CNTK::OptimizedRNNStack;
IGNORE_FUNCTION CNTK::Clip;
IGNORE_FUNCTION CNTK::ElementSelect;
IGNORE_FUNCTION CNTK::Splice;
IGNORE_FUNCTION CNTK::StopGradient;
IGNORE_FUNCTION CNTK::Assign;
IGNORE_FUNCTION CNTK::ELU;
IGNORE_FUNCTION CNTK::LeakyReLU;
IGNORE_FUNCTION CNTK::PReLU;
IGNORE_FUNCTION CNTK::Softplus;
IGNORE_FUNCTION CNTK::Argmax;
IGNORE_FUNCTION CNTK::Argmin;
IGNORE_FUNCTION CNTK::ToSequence;
IGNORE_FUNCTION CNTK::ToSequenceLike;
IGNORE_FUNCTION CNTK::AsBlock;
IGNORE_FUNCTION CNTK::ReaderCrop;
IGNORE_FUNCTION CNTK::ReaderMean;
IGNORE_FUNCTION CNTK::ReaderScale;
IGNORE_FUNCTION CNTK::ReaderColor;
IGNORE_FUNCTION CNTK::ImageDeserializer;
IGNORE_FUNCTION CNTK::Base64ImageDeserializer;
IGNORE_FUNCTION CNTK::CTFDeserializer;
IGNORE_FUNCTION CNTK::HTKFeatureDeserializer;
IGNORE_FUNCTION CNTK::HTKMLFDeserializer;
%ignore_namespace CNTK::Sequence;
IGNORE_NAMESPACE CNTK::Sequence;
%ignore_class CNTK::TrainingParameterSchedule;
%ignore_class CNTK::TrainingParameterPerUnitSchedule;
%ignore_class CNTK::TrainingParameterPerSampleSchedule;
%ignore_class CNTK::TrainingParameterPerMinibatchSchedule;
%ignore_class CNTK::LearningRatePerSampleSchedule;
%ignore_class CNTK::LearningRatePerMinibatchSchedule;
%ignore_class CNTK::MinibatchSizeSchedule;
%ignore_class CNTK::LearningRateSchedule;
%ignore_class CNTK::MomentumSchedule;
%ignore_class CNTK::MomentumPerSampleSchedule;
%ignore_class CNTK::MomentumPerMinibatchSchedule;
%ignore_class CNTK::MomentumAsTimeConstantSchedule;
%ignore_struct CNTK::AdditionalLearningOptions;
%ignore_class CNTK::Learner;
IGNORE_CLASS CNTK::TrainingParameterSchedule;
IGNORE_CLASS CNTK::TrainingParameterPerUnitSchedule;
IGNORE_CLASS CNTK::TrainingParameterPerSampleSchedule;
IGNORE_CLASS CNTK::TrainingParameterPerMinibatchSchedule;
IGNORE_CLASS CNTK::LearningRatePerSampleSchedule;
IGNORE_CLASS CNTK::LearningRatePerMinibatchSchedule;
IGNORE_CLASS CNTK::MinibatchSizeSchedule;
IGNORE_CLASS CNTK::LearningRateSchedule;
IGNORE_CLASS CNTK::MomentumSchedule;
IGNORE_CLASS CNTK::MomentumPerSampleSchedule;
IGNORE_CLASS CNTK::MomentumPerMinibatchSchedule;
IGNORE_CLASS CNTK::MomentumAsTimeConstantSchedule;
IGNORE_STRUCT CNTK::AdditionalLearningOptions;
IGNORE_CLASS CNTK::Learner;
%ignore_function CNTK::DefaultUnitGainValue;
%ignore_function CNTK::SetDefaultUnitGainValue;
IGNORE_FUNCTION CNTK::DefaultUnitGainValue;
IGNORE_FUNCTION CNTK::SetDefaultUnitGainValue;
%ignore_function CNTK::SGDLearner;
%ignore_function CNTK::MomentumSGDLearner;
%ignore_function CNTK::NesterovLearner;
IGNORE_FUNCTION CNTK::SGDLearner;
IGNORE_FUNCTION CNTK::MomentumSGDLearner;
IGNORE_FUNCTION CNTK::NesterovLearner;
%ignore_variable CNTK::DefaultVarianceMomentum;
IGNORE_VARIABLE CNTK::DefaultVarianceMomentum;
%ignore_function CNTK::FSAdaGradLearner;
%ignore_function CNTK::AdamLearner;
%ignore_function CNTK::AdaGradLearner;
%ignore_function CNTK::RMSPropLearner;
%ignore_function CNTK::AdaDeltaLearner;
%ignore_function CNTK::UniversalLearner;
%ignore_function CNTK::Internal::UniversalLearner;
IGNORE_FUNCTION CNTK::FSAdaGradLearner;
IGNORE_FUNCTION CNTK::AdamLearner;
IGNORE_FUNCTION CNTK::AdaGradLearner;
IGNORE_FUNCTION CNTK::RMSPropLearner;
IGNORE_FUNCTION CNTK::AdaDeltaLearner;
IGNORE_FUNCTION CNTK::UniversalLearner;
IGNORE_FUNCTION CNTK::Internal::UniversalLearner;
%ignore_class CNTK::DistributedLearner;
IGNORE_CLASS CNTK::DistributedLearner;
%ignore_function CNTK::CreateDataParallelDistributedLearner;
%ignore_function CNTK::CreateQuantizedDataParallelDistributedLearner;
%ignore_function CNTK::CreateBlockMomentumDistributedLearner;
IGNORE_FUNCTION CNTK::CreateDataParallelDistributedLearner;
IGNORE_FUNCTION CNTK::CreateQuantizedDataParallelDistributedLearner;
IGNORE_FUNCTION CNTK::CreateBlockMomentumDistributedLearner;
%ignore_class CNTK::Trainer;
%ignore_function CNTK::CreateTrainer;
%ignore_class CNTK::Evaluator;
%ignore_function CNTK::CreateEvaluator;
%ignore_struct CNTK::StreamInformation;
%ignore_struct std::hash<::CNTK::StreamInformation>;
IGNORE_CLASS CNTK::Trainer;
IGNORE_FUNCTION CNTK::CreateTrainer;
IGNORE_CLASS CNTK::Evaluator;
IGNORE_FUNCTION CNTK::CreateEvaluator;
IGNORE_STRUCT CNTK::StreamInformation;
IGNORE_STRUCT std::hash<::CNTK::StreamInformation>;
%ignore operator==(const StreamInformation& left, const StreamInformation& right);
%ignore_struct CNTK::MinibatchData;
%ignore_class CNTK::MinibatchSource;
%ignore_struct CNTK::MinibatchInfo;
%ignore_struct CNTK::MinibatchSourceConfig;
IGNORE_STRUCT CNTK::MinibatchData;
IGNORE_CLASS CNTK::MinibatchSource;
IGNORE_STRUCT CNTK::MinibatchInfo;
IGNORE_STRUCT CNTK::MinibatchSourceConfig;
%ignore_function CNTK::CreateCompositeMinibatchSource;
%ignore_struct CNTK::StreamConfiguration;
%ignore_struct CNTK::HTKFeatureConfiguration;
%ignore_function CNTK::TextFormatMinibatchSource;
%ignore_function CNTK::ComputeInputPerDimMeansAndInvStdDevs;
%ignore_struct CNTK::DistributedWorkerDescriptor;
IGNORE_FUNCTION CNTK::CreateCompositeMinibatchSource;
IGNORE_STRUCT CNTK::StreamConfiguration;
IGNORE_STRUCT CNTK::HTKFeatureConfiguration;
IGNORE_FUNCTION CNTK::TextFormatMinibatchSource;
IGNORE_FUNCTION CNTK::ComputeInputPerDimMeansAndInvStdDevs;
IGNORE_STRUCT CNTK::DistributedWorkerDescriptor;
%ignore operator==(const DistributedWorkerDescriptor& left, const DistributedWorkerDescriptor& right);
%ignore_class CNTK::DistributedCommunicator;
%ignore_class CNTK::QuantizedDistributedCommunicator;
%ignore_function CNTK::MPICommunicator;
%ignore_function CNTK::QuantizedMPICommunicator;
%ignore_struct CNTK::CrossValidationConfig;
%ignore_struct CNTK::CheckpointConfig;
%ignore_struct CNTK::TestConfig;
IGNORE_CLASS CNTK::DistributedCommunicator;
IGNORE_CLASS CNTK::QuantizedDistributedCommunicator;
IGNORE_FUNCTION CNTK::MPICommunicator;
IGNORE_FUNCTION CNTK::QuantizedMPICommunicator;
IGNORE_STRUCT CNTK::CrossValidationConfig;
IGNORE_STRUCT CNTK::CheckpointConfig;
IGNORE_STRUCT CNTK::TestConfig;
%ignore_class CNTK::TrainingSession;
%ignore_function CNTK::CreateBasicTrainingSession;
%ignore_function CNTK::CreateTrainingSession;
%ignore_function CNTK::CreateDataParallelDistributedTrainer;
%ignore_function CNTK::CreateQuantizedDataParallelDistributedTrainer;
IGNORE_CLASS CNTK::TrainingSession;
IGNORE_FUNCTION CNTK::CreateBasicTrainingSession;
IGNORE_FUNCTION CNTK::CreateTrainingSession;
IGNORE_FUNCTION CNTK::CreateDataParallelDistributedTrainer;
IGNORE_FUNCTION CNTK::CreateQuantizedDataParallelDistributedTrainer;
%ignore_class CNTK::ProgressWriter;
IGNORE_CLASS CNTK::ProgressWriter;
%ignore_function CNTK::SetCheckedMode;
%ignore_function CNTK::GetCheckedMode;
IGNORE_FUNCTION CNTK::SetCheckedMode;
IGNORE_FUNCTION CNTK::GetCheckedMode;
%ignore_struct std::hash<::CNTK::DistributedWorkerDescriptor>;
IGNORE_STRUCT std::hash<::CNTK::DistributedWorkerDescriptor>;
// Ignore things in CNTKLibraryInternals.h that are not exposed for C# Eval.
%ignore_function CNTK::Internal::GenerateUid;
%ignore_enum_class CNTK::Internal::PrimitiveFunction;
%ignore_class CNTK::Internal::CompositeFunction;
%ignore_function CNTK::Internal::MaxNumCPUThreadsSet;
%ignore_enum_class CNTK::PrimitiveOpType;
%ignore_function CNTK::Internal::IsWithin;
%ignore_function CNTK::Internal::PackedIndex;
%ignore_function CNTK::Internal::GatherPacked;
%ignore_function CNTK::Internal::ScatterPacked;
%ignore_function CNTK::Internal::ReconcileDynamicAxes;
%ignore_function CNTK::Internal::ZeroesWithDynamicAxesLike;
%ignore_function CNTK::Internal::Where;
%ignore_function CNTK::Internal::Gather;
%ignore_function CNTK::Internal::Scatter;
%ignore_function CNTK::Internal::Slice;
%ignore_function CNTK::Internal::ReduceElements;
%ignore_function CNTK::Internal::CosineDistanceWithNegativeSamples;
%ignore_function CNTK::Internal::Convolution;
%ignore_function CNTK::Internal::SaveAsLegacyModel;
%ignore_function CNTK::Internal::AddProgressWriters;
%ignore_function CNTK::Internal::NewUniqueId;
IGNORE_FUNCTION CNTK::Internal::GenerateUid;
IGNORE_ENUM_CLASS CNTK::Internal::PrimitiveFunction;
IGNORE_CLASS CNTK::Internal::CompositeFunction;
IGNORE_FUNCTION CNTK::Internal::MaxNumCPUThreadsSet;
IGNORE_ENUM_CLASS CNTK::PrimitiveOpType;
IGNORE_FUNCTION CNTK::Internal::IsWithin;
IGNORE_FUNCTION CNTK::Internal::PackedIndex;
IGNORE_FUNCTION CNTK::Internal::GatherPacked;
IGNORE_FUNCTION CNTK::Internal::ScatterPacked;
IGNORE_FUNCTION CNTK::Internal::ReconcileDynamicAxes;
IGNORE_FUNCTION CNTK::Internal::ZeroesWithDynamicAxesLike;
IGNORE_FUNCTION CNTK::Internal::Where;
IGNORE_FUNCTION CNTK::Internal::Gather;
IGNORE_FUNCTION CNTK::Internal::Scatter;
IGNORE_FUNCTION CNTK::Internal::Slice;
IGNORE_FUNCTION CNTK::Internal::ReduceElements;
IGNORE_FUNCTION CNTK::Internal::CosineDistanceWithNegativeSamples;
IGNORE_FUNCTION CNTK::Internal::Convolution;
IGNORE_FUNCTION CNTK::Internal::SaveAsLegacyModel;
IGNORE_FUNCTION CNTK::Internal::AddProgressWriters;
IGNORE_FUNCTION CNTK::Internal::NewUniqueId;
%ignore_function CNTK::Internal::EnableReversingTensorShapesInErrorMessages;
%ignore_function CNTK::Internal::IsReversingTensorShapesInErrorMessagesEnabled;
%ignore_function CNTK::Internal::AlwaysAllowSettingDefaultDevice;
%ignore_function CNTK::Internal::IsSettingDefaultDeviceAlwaysAllowed;
%ignore_function CNTK::Internal::AllowRenamingFunctions;
%ignore_function CNTK::Internal::IsRenamingFunctionsAllowed;
%ignore_function CNTK::Internal::SetAutomaticUnpackingOfPackedValues;
%ignore_function CNTK::Internal::IsAutomaticUnpackingOfPackedValuesDisabled;
%ignore_function CNTK::Internal::SetComputationNetworkTraceLevel;
%ignore_function CNTK::Internal::GetComputationNetworkTraceLevel;
%ignore_function CNTK::Internal::SetGPUMemoryAllocationTraceLevel;
%ignore_function CNTK::Internal::ForceSynchronousCUDAKernelExecutions;
%ignore_function CNTK::Internal::ForceDeterministicAlgorithms;
%ignore_function CNTK::Internal::ShouldForceDeterministicAlgorithms;
%ignore_function CNTK::Internal::EnableSynchronousGPUKernelExecution;
%ignore_function CNTK::Internal::IsSynchronousGPUKernelExecutionEnabled;
%ignore_function CNTK::Internal::SetFixedRandomSeed;
%ignore_function CNTK::Internal::EnableForwardValuesSharing;
%ignore_function CNTK::Internal::DisableForwardValuesSharing;
%ignore_function CNTK::Internal::EnableGradientAccumulationOptimization;
%ignore_function CNTK::Internal::DisableGradientAccumulationOptimization;
IGNORE_FUNCTION CNTK::Internal::EnableReversingTensorShapesInErrorMessages;
IGNORE_FUNCTION CNTK::Internal::IsReversingTensorShapesInErrorMessagesEnabled;
IGNORE_FUNCTION CNTK::Internal::AlwaysAllowSettingDefaultDevice;
IGNORE_FUNCTION CNTK::Internal::IsSettingDefaultDeviceAlwaysAllowed;
IGNORE_FUNCTION CNTK::Internal::AllowRenamingFunctions;
IGNORE_FUNCTION CNTK::Internal::IsRenamingFunctionsAllowed;
IGNORE_FUNCTION CNTK::Internal::SetAutomaticUnpackingOfPackedValues;
IGNORE_FUNCTION CNTK::Internal::IsAutomaticUnpackingOfPackedValuesDisabled;
IGNORE_FUNCTION CNTK::Internal::SetComputationNetworkTraceLevel;
IGNORE_FUNCTION CNTK::Internal::GetComputationNetworkTraceLevel;
IGNORE_FUNCTION CNTK::Internal::SetGPUMemoryAllocationTraceLevel;
IGNORE_FUNCTION CNTK::Internal::ForceSynchronousCUDAKernelExecutions;
IGNORE_FUNCTION CNTK::Internal::ForceDeterministicAlgorithms;
IGNORE_FUNCTION CNTK::Internal::ShouldForceDeterministicAlgorithms;
IGNORE_FUNCTION CNTK::Internal::EnableSynchronousGPUKernelExecution;
IGNORE_FUNCTION CNTK::Internal::IsSynchronousGPUKernelExecutionEnabled;
IGNORE_FUNCTION CNTK::Internal::SetFixedRandomSeed;
IGNORE_FUNCTION CNTK::Internal::EnableForwardValuesSharing;
IGNORE_FUNCTION CNTK::Internal::DisableForwardValuesSharing;
IGNORE_FUNCTION CNTK::Internal::EnableGradientAccumulationOptimization;
IGNORE_FUNCTION CNTK::Internal::DisableGradientAccumulationOptimization;
%ignore CNTK::Internal::DefaultProfilerBufferSize;
%ignore_function CNTK::Internal::StartProfiler;
%ignore_function CNTK::Internal::StopProfiler;
%ignore_function CNTK::Internal::EnableProfiler;
%ignore_function CNTK::Internal::DisableProfiler;
%ignore_function CNTK::Internal::AreEquivalent;
%ignore_function CNTK::Internal::AreEqual;
%ignore_function CNTK::Internal::PrintBuiltInfo;
%ignore_function CNTK::Internal::PrintGpuInfo;
%ignore_function CNTK::Internal::DefaultPackThresholdSizeInBytes;
%ignore_function CNTK::Internal::ToDictionary;
IGNORE_FUNCTION CNTK::Internal::StartProfiler;
IGNORE_FUNCTION CNTK::Internal::StopProfiler;
IGNORE_FUNCTION CNTK::Internal::EnableProfiler;
IGNORE_FUNCTION CNTK::Internal::DisableProfiler;
IGNORE_FUNCTION CNTK::Internal::AreEquivalent;
IGNORE_FUNCTION CNTK::Internal::AreEqual;
IGNORE_FUNCTION CNTK::Internal::PrintBuiltInfo;
IGNORE_FUNCTION CNTK::Internal::PrintGpuInfo;
IGNORE_FUNCTION CNTK::Internal::DefaultPackThresholdSizeInBytes;
IGNORE_FUNCTION CNTK::Internal::ToDictionary;
%ignore_class CNTK::Internal::TensorBoardFileWriter;
IGNORE_CLASS CNTK::Internal::TensorBoardFileWriter;
// suppress SWIG warning 302: Identifier redefined.
%ignore CNTK::Internal::TensorBoardFileWriter::TensorBoardFileWriter(const std::wstring& dir, const ::Microsoft::MSR::CNTK::ComputationNetworkPtr& modelToVisualize = nullptr);
%ignore_struct CNTK::GPUProperties;
%ignore_function CNTK::DeviceDescriptor::GetGPUProperties;
IGNORE_STRUCT CNTK::GPUProperties;
IGNORE_FUNCTION CNTK::DeviceDescriptor::GetGPUProperties;
//use when the wrapped method returns an idiomatic type
//for non-idiomatic types, such as the default collection wrappers use RENAME_AND_MAKE_PRIVATE below
//and then write custom method in the language specific file
#ifdef SWIGCSHARP
#define MAKE_PRIVATE(x) %csmethodmodifiers x "private"
%define RENAME_AND_MAKE_PRIVATE(namespace, method)
%csmethodmodifiers namespace##::##method "private";
%rename (_##method) namespace##::##method
%enddef
// For C#, property needs to be added as cscode. Here we just rename the corresponding C++ method and make it as private.
#define MAKE_GETTER(namespace, method) RENAME_AND_MAKE_PRIVATE(namespace, method)
#endif //SWIGCSHARP
#ifdef SWIGJAVA
%define MAKE_GETTER(namespace, method)
%rename (get ## method) namespace##::##method
%enddef
#define MAKE_PRIVATE(x) %javamethodmodifiers x "private"
%define RENAME_AND_MAKE_PRIVATE(namespace, method)
%javamethodmodifiers namespace##::##method "private";
%rename (_##method) namespace##::##method
%enddef
#endif //SWIGJAVA
// include common warning filters
%include "CNTKWarnFilters.i"
@ -425,15 +418,20 @@ SWIG_STD_VECTOR_ENHANCED(CNTK::DeviceDescriptor)
%apply double INPUT[] { double *dataBuffer }
#endif
%rename(AreEqual) operator==;
%rename(AreNotEqual) operator!=;
%ignore operator[];
// exception handling
%include "CNTKExceptionHandling.i"
// class DeviceDescriptor
RENAME_AND_MAKE_PRIVATE(CNTK::DeviceDescriptor, Type);
MAKE_GETTER(CNTK::DeviceDescriptor, Id);
MAKE_GETTER(CNTK::DeviceDescriptor, CPUDevice);
RENAME_AND_MAKE_PRIVATE(CNTK::DeviceDescriptor, AllDevices);
RENAME_AND_MAKE_PRIVATE(CNTK::DeviceDescriptor, SetExcludedDevices);
RENAME_AND_MAKE_PRIVATE(CNTK::DeviceDescriptor, Type);
#ifdef SWIGJAVA
%rename (isLocked) CNTK::DeviceDescriptor::IsLocked;
%rename (getGPUDevice) CNTK::DeviceDescriptor::GPUDevice;
@ -441,33 +439,43 @@ RENAME_AND_MAKE_PRIVATE(CNTK::DeviceDescriptor, SetExcludedDevices);
%rename (trySetDefaultDevice) CNTK::DeviceDescriptor::TrySetDefaultDevice;
%rename (toString) CNTK::DeviceDescriptor::AsString;
#endif
%rename (AreEqualDeviceDescriptor) CNTK::operator==(const DeviceDescriptor& left, const DeviceDescriptor& right);
// class Axis
IGNORE_FUNCTION CNTK::Axis::DefaultDynamicAxis();
IGNORE_FUNCTION CNTK::Axis::OperandSequenceAxis();
IGNORE_FUNCTION CNTK::Axis::DefaultBatchAxis();
IGNORE_FUNCTION CNTK::Axis::AllStaticAxes();
IGNORE_FUNCTION CNTK::Axis::AllAxes();
IGNORE_FUNCTION CNTK::Axis::DefaultInputVariableDynamicAxes();
IGNORE_FUNCTION CNTK::Axis::UnknownDynamicAxes();
MAKE_GETTER(CNTK::Axis, Name);
MAKE_GETTER(CNTK::Axis, StaticAxisIndex);
#ifdef SWIGCSHARP
RENAME_AND_MAKE_PRIVATE(CNTK::Axis, IsOrdered);
// It cannot be a property as it has a parameter.
RENAME_AND_MAKE_PRIVATE(CNTK::Axis, StaticAxisIndex);
#endif
#ifdef SWIGJAVA
MAKE_GETTER(CNTK::Axis, StaticAxisIndex);
%rename (isStaticAxis) CNTK::Axis::IsStaticAxis;
%rename (isDynamicAxis) CNTK::Axis::IsDynamicAxis;
%rename (isOrdered) CNTK::Axis::IsOrdered;
%rename (endStaticAxis) CNTK::Axis::EndStaticAxis;
%rename (toString) CNTK::Axis::AsString;
#endif
%ignore_function CNTK::Axis::DefaultDynamicAxis();
%ignore_function CNTK::Axis::OperandSequenceAxis();
%ignore_function CNTK::Axis::DefaultBatchAxis();
%ignore_function CNTK::Axis::AllStaticAxes();
%ignore_function CNTK::Axis::AllAxes();
%ignore_function CNTK::Axis::DefaultInputVariableDynamicAxes();
%ignore_function CNTK::Axis::UnknownDynamicAxes();
%rename(AreEqual) operator==;
%rename(AreNotEqual) operator!=;
%ignore operator[];
// class Function
%ignore CNTK::Function::BlockArgumentsMapping;
%ignore CNTK::GetCorrespondingOutputVariableFromClone;
IGNORE_FUNCTION CNTK::Function::BlockArgumentsMapping;
IGNORE_FUNCTION CNTK::GetCorrespondingOutputVariableFromClone;
IGNORE_FUNCTION CNTK::Function::RegisterUDFDeserializeCallback;
IGNORE_FUNCTION CNTK::Function::GetUDFDeserializeCallback;
IGNORE_CLASS CNTK::Internal::UDFDeserializeCallbackWrapper;
IGNORE_FUNCTION CNTK::Internal::RegisterUDFDeserializeCallbackWrapper;
IGNORE_FUNCTION CNTK::Internal::IsNativeUserFunctionRegistered;
// Ignore exposing istream to C# for now. Todo: find a good solution to map C# System.IO.Stream to std::istream.
%ignore CNTK::Function::Load(std::istream& inputStream, const DeviceDescriptor& computeDevice= DeviceDescriptor::UseDefaultDevice());
MAKE_GETTER(CNTK::Function, Name);
MAKE_GETTER(CNTK::Function, Uid);
@ -484,6 +492,20 @@ RENAME_AND_MAKE_PRIVATE(CNTK::Function, IsPrimitive);
RENAME_AND_MAKE_PRIVATE(CNTK::Function, IsBlock);
RENAME_AND_MAKE_PRIVATE(CNTK::Function, Clone);
// TODO: also apply to Java when possible.
#ifdef SWIGCSHARP
RENAME_AND_MAKE_PRIVATE(CNTK::Function, Evaluate);
RENAME_AND_MAKE_PRIVATE(CNTK::Function, Load);
RENAME_AND_MAKE_PRIVATE(CNTK::Function, FindByName);
#endif // SWIGCSHARP
// Customize type mapping for modelBuffer, used by Load
#ifdef SWIGCSHARP
%typemap(ctype) (char* buffer) "char*"
%typemap(imtype) (char* buffer) "byte[]"
%typemap(cstype) (char* buffer) "byte[]"
#endif // SWIGCSHARP
#ifdef SWIGJAVA
%rename (load) CNTK::Function::Load;
%rename (combine) CNTK::Function::Combine;
@ -497,31 +519,9 @@ RENAME_AND_MAKE_PRIVATE(CNTK::Function, Clone);
%rename (toString) CNTK::Function::AsString;
#endif
%rename_and_make_private(CNTK::Function, Evaluate);
%rename_and_make_private(CNTK::Function, Load);
%rename_and_make_private(CNTK::Function, FindByName);
%rename_and_make_private(CNTK::Function, FindAllWithName);
%rename_and_make_private(CNTK::Function, Clone);
// Ignore exposing istream to C# for now. Todo: find a good solution to map C# System.IO.Stream to std::istream.
%ignore CNTK::Function::Load(std::istream& inputStream, const DeviceDescriptor& computeDevice= DeviceDescriptor::UseDefaultDevice());
%ignore CNTK::Function::RegisterUDFDeserializeCallback;
%ignore CNTK::Function::GetUDFDeserializeCallback;
%ignore_class CNTK::Internal::UDFDeserializeCallbackWrapper;
%ignore_function CNTK::Internal::RegisterUDFDeserializeCallbackWrapper;
%ignore_function CNTK::Internal::IsNativeUserFunctionRegistered;
#ifdef SWIGCSHARP
// Customize type mapping for modelBuffer, used by Load
%typemap(ctype) (char* buffer) "char*"
%typemap(imtype) (char* buffer) "byte[]"
%typemap(cstype) (char* buffer) "byte[]"
#endif // SWIGCSHARP
#ifdef SWIGJAVA
// Customize type mapping for modelBuffer, used by Load
// template taken from various.i
#ifdef SWIGJAVA
%typemap(jni) (char* buffer) "jbyteArray"
%typemap(jtype) (char* buffer) "byte[]"
%typemap(jstype) (char* buffer) "byte[]"
@ -540,7 +540,7 @@ RENAME_AND_MAKE_PRIVATE(CNTK::Function, Clone);
%ignore CNTK::Variable::Variable;
%ignore CNTK::Variable::operator FunctionPtr;
%rename ("%s") CNTK::Variable::Variable(const FunctionPtr& function);
<<<<<<< 4b4cf975110f13ad85bbea11fe7416c0c676a12d
MAKE_GETTER(CNTK::Variable, Shape);
MAKE_GETTER(CNTK::Variable, Name);
MAKE_GETTER(CNTK::Variable, Uid);
@ -553,6 +553,11 @@ RENAME_AND_MAKE_PRIVATE(CNTK::Variable, IsOutput);
RENAME_AND_MAKE_PRIVATE(CNTK::Variable, IsParameter);
RENAME_AND_MAKE_PRIVATE(CNTK::Variable, IsConstant);
RENAME_AND_MAKE_PRIVATE(CNTK::Variable, IsPlaceholder);
#ifdef SWIGCSHARP
RENAME_AND_MAKE_PRIVATE(CNTK::Variable, NeedsGradient);
#endif
#ifdef SWIGJAVA
%rename (getDataType) CNTK::Variable::GetDataType;
%rename (needsGradient) CNTK::Variable::NeedsGradient;
@ -561,49 +566,34 @@ RENAME_AND_MAKE_PRIVATE(CNTK::Variable, IsPlaceholder);
#endif
// class NDShape
%ignore CNTK::NDShape::NDShape(const std::initializer_list<size_t>& dimensions);
%ignore CNTK::NDShape::InferredDimension;
%ignore CNTK::NDShape::FreeDimension;
MAKE_GETTER(CNTK::NDShape, Rank);
MAKE_GETTER(CNTK::NDShape, TotalSize);
RENAME_AND_MAKE_PRIVATE(CNTK::NDShape, Dimensions);
#ifdef SWIGCSHARP
RENAME_AND_MAKE_PRIVATE(CNTK::NDShape, IsUnknown);
RENAME_AND_MAKE_PRIVATE(CNTK::NDShape, HasInferredDimension);
RENAME_AND_MAKE_PRIVATE(CNTK::NDShape, HasFreeDimension);
RENAME_AND_MAKE_PRIVATE(CNTK::NDShape, HasUnboundDimension);
RENAME_AND_MAKE_PRIVATE(CNTK::NDShape, SubShape);
#endif
#ifdef SWIGJAVA
%rename (isUnknown) CNTK::NDShape::IsUnknown;
%rename (hasUnboundDimension) CNTK::NDShape::HasUnboundDimension;
%rename (hasInferredDimension) CNTK::NDShape::HasInferredDimension;
%rename (hasFreeDimension) CNTK::NDShape::HasFreeDimension;
%rename (appendShape) CNTK::NDShape::AppendShape;
%rename (alias) CNTK::NDShape::Alias;
%rename (copyFrom) CNTK::NDShape::CopyFrom;
%rename (subShape) CNTK::NDShape::SubShape;
%rename (toString) CNTK::NDShape::AsString;
#endif
=======
%rename (GetShape) CNTK::Variable::Shape;
%rename (GetName) CNTK::Variable::Name;
%rename (GetVariableKind) CNTK::Variable::Kind;
%rename (GetDynamicAxes) CNTK::Variable::DynamicAxes;
%rename (_IsSparse) CNTK::Variable::IsSparse;
%rename (_IsInput) CNTK::Variable::IsInput;
%rename (_IsOutput) CNTK::Variable::IsOutput;
%rename (_IsParameter) CNTK::Variable::IsParameter;
%rename (_IsConstant) CNTK::Variable::IsConstant;
%rename (_IsPlaceholder) CNTK::Variable::IsPlaceholder;
%rename (_NeedsGradient) CNTK::Variable::NeedsGradient;
%rename (GetOwner) CNTK::Variable::Owner;
// class NDShape
%rename (GetDimensions) CNTK::NDShape::Dimensions;
%rename (GetRank) CNTK::NDShape::Rank;
%rename (GetTotalSize) CNTK::NDShape::TotalSize;
%rename (_IsUnknown) CNTK::NDShape::IsUnknown;
%rename (_HasInferredDimension) CNTK::NDShape::HasInferredDimension;
%rename (_HasFreeDimension) CNTK::NDShape::HasFreeDimension;
%rename (_HasUnboundDimension) CNTK::NDShape::HasUnboundDimension;
>>>>>>> make more methods private; add missing methods to C#
%ignore CNTK::NDShape::NDShape(const std::initializer_list<size_t>& dimensions);
%ignore CNTK::NDShape::InferredDimension;
%ignore CNTK::NDShape::FreeDimension;
%extend CNTK::NDShape {
size_t _DimensionSize(size_t axisId)
@ -611,11 +601,11 @@ RENAME_AND_MAKE_PRIVATE(CNTK::NDShape, HasFreeDimension);
return (*self)[axisId];
}
}
%make_private(CNTK::NDShape::GetDimensionSize);
// class NDMask
// Todo: add correct typemap as they might be useful in future.
%ignore_function CNTK::NDMask::DataBuffer;
IGNORE_FUNCTION CNTK::NDMask::DataBuffer;
MAKE_GETTER(CNTK::NDMask, MaskedCount);
MAKE_GETTER(CNTK::NDMask, Device);
MAKE_GETTER(CNTK::NDMask, Shape);
@ -629,14 +619,7 @@ RENAME_AND_MAKE_PRIVATE(CNTK::NDMask, MarkSequenceBegin);
%rename (copyFrom) CNTK::NDMask::CopyFrom;
#endif
#ifdef SWIGCSHARP
// class Value
%apply int INPUT[] { int *colStarts }
%apply int INPUT[] { int *rowIndices }
%apply float INPUT[] { float *nonZeroValues }
%apply double INPUT[] { double *nonZeroValues }
#endif
MAKE_GETTER(CNTK::Value, Device);
MAKE_GETTER(CNTK::Value, Shape);
MAKE_GETTER(CNTK::Value, Data);
@ -646,6 +629,30 @@ RENAME_AND_MAKE_PRIVATE(CNTK::Value, IsReadOnly);
RENAME_AND_MAKE_PRIVATE(CNTK::Value, MaskedCount);
RENAME_AND_MAKE_PRIVATE(CNTK::Value, IsValid);
// TODO: make the following methods also private in Java, after CreateBatch/CreateSequence/... methods are implemented there.
#ifdef SWIGCSHARP
MAKE_PRIVATE(CNTK::Value::CreateDenseFloat);
MAKE_PRIVATE(CNTK::Value::CreateDenseDouble);
MAKE_PRIVATE(CNTK::Value::CreateBatchFloat);
MAKE_PRIVATE(CNTK::Value::CreateBatchDouble);
MAKE_PRIVATE(CNTK::Value::CreateSequenceFloat);
MAKE_PRIVATE(CNTK::Value::CreateSequenceDouble);
MAKE_PRIVATE(CNTK::Value::CreateOneHotFloat);
MAKE_PRIVATE(CNTK::Value::CreateOneHotDouble);
MAKE_PRIVATE(CNTK::Value::CopyVariableValueTo);
MAKE_PRIVATE(CNTK::Value::CopyVariableValueToFloat);
MAKE_PRIVATE(CNTK::Value::CopyVariableValueToDouble);
MAKE_PRIVATE(CNTK::Value::Create);
RENAME_AND_MAKE_PRIVATE(CNTK::Value, Alias);
#endif // SWIGCSHARP
#ifdef SWIGCSHARP
%apply int INPUT[] { int *colStarts }
%apply int INPUT[] { int *rowIndices }
%apply float INPUT[] { float *nonZeroValues }
%apply double INPUT[] { double *nonZeroValues }
#endif
#ifdef SWIGJAVA
%rename (create) CNTK::Value::Create;
%rename (getDataType) CNTK::Value::GetDataType;
@ -670,23 +677,6 @@ RENAME_AND_MAKE_PRIVATE(CNTK::Value, IsValid);
%rename (toString) CNTK::Value::AsString;
#endif
// TODO: make the following methods also private in Java, after CreateBatch/CreateSequence/... methods are implemented there.
#ifdef SWIGCSHARP
%make_private(CNTK::Value::CreateDenseFloat);
%make_private(CNTK::Value::CreateDenseDouble);
%make_private(CNTK::Value::CreateBatchFloat);
%make_private(CNTK::Value::CreateBatchDouble);
%make_private(CNTK::Value::CreateSequenceFloat);
%make_private(CNTK::Value::CreateSequenceDouble);
%make_private(CNTK::Value::CreateOneHotFloat);
%make_private(CNTK::Value::CreateOneHotDouble);
%make_private(CNTK::Value::CopyVariableValueTo);
%make_private(CNTK::Value::CopyVariableValueToFloat);
%make_private(CNTK::Value::CopyVariableValueToDouble);
%make_private(CNTK::Value::Create);
%rename_and_make_private(CNTK::Value, Alias);
#endif
%include "CNTKValueExtend.i"
// class NDArrayView
@ -694,8 +684,26 @@ RENAME_AND_MAKE_PRIVATE(CNTK::Value, IsValid);
%ignore CNTK::NDArrayView::NDArrayView(::CNTK::DataType dataType, const NDShape& viewShape, const void* dataBuffer, size_t bufferSizeInBytes, const DeviceDescriptor& device);
%ignore CNTK::NDArrayView::NDArrayView(double value, DataType dataType = DataType::Float, const NDShape& viewShape = { 1 }, const DeviceDescriptor& device = DeviceDescriptor::UseDefaultDevice(), bool readOnly = false);
MAKE_GETTER(CNTK::NDArrayView, Device);
MAKE_GETTER(CNTK::NDArrayView, Shape);
RENAME_AND_MAKE_PRIVATE(CNTK::NDArrayView, IsSparse);
RENAME_AND_MAKE_PRIVATE(CNTK::NDArrayView, IsReadOnly);
RENAME_AND_MAKE_PRIVATE(CNTK::NDArrayView, SliceView);
#ifdef SWIGCSHARP
%rename_and_make_private(CNTK::NDArrayView, Alias);
RENAME_AND_MAKE_PRIVATE(CNTK::NDArrayView, Alias);
#endif
#ifdef SWIGJAVA
%rename (getDataType) CNTK::NDArrayView::GetDataType;
%rename (getStorageFormat) CNTK::NDArrayView::GetStorageFormat;
%rename (setValue) CNTK::NDArrayView::SetValue;
%rename (deepClone) CNTK::NDArrayView::DeepClone;
%rename (alias) CNTK::NDArrayView::Alias;
%rename (asShape) CNTK::NDArrayView::AsShape;
%rename (copyFrom) CNTK::NDArrayView::CopyFrom;
%rename (changeDevice) CNTK::NDArrayView::ChangeDevice;
%rename (toString) CNTK::NDArrayView::AsString;
#endif
%extend CNTK::NDArrayView {
@ -735,20 +743,3 @@ RENAME_AND_MAKE_PRIVATE(CNTK::Value, IsValid);
return new CNTK::NDArrayView(viewShape, colStarts, rowIndices, nonZeroValues, numNonZeroValues, device, readOnly);
}
}
MAKE_GETTER(CNTK::NDArrayView, Device);
MAKE_GETTER(CNTK::NDArrayView, Shape);
RENAME_AND_MAKE_PRIVATE(CNTK::NDArrayView, IsSparse);
RENAME_AND_MAKE_PRIVATE(CNTK::NDArrayView, IsReadOnly);
RENAME_AND_MAKE_PRIVATE(CNTK::NDArrayView, SliceView);
#ifdef SWIGJAVA
%rename (getDataType) CNTK::NDArrayView::GetDataType;
%rename (getStorageFormat) CNTK::NDArrayView::GetStorageFormat;
%rename (setValue) CNTK::NDArrayView::SetValue;
%rename (deepClone) CNTK::NDArrayView::DeepClone;
%rename (alias) CNTK::NDArrayView::Alias;
%rename (asShape) CNTK::NDArrayView::AsShape;
%rename (copyFrom) CNTK::NDArrayView::CopyFrom;
%rename (changeDevice) CNTK::NDArrayView::ChangeDevice;
%rename (toString) CNTK::NDArrayView::AsString;
#endif

Просмотреть файл

@ -13,7 +13,7 @@
// Property Id.
public int Id
{
get { return (int)GetId(); }
get { return (int)_Id(); }
}
// Property Type.
@ -25,7 +25,7 @@
// Property CPUDevice.
public static DeviceDescriptor CPUDevice
{
get { return GetCPUDevice(); }
get { return _CPUDevice(); }
}
// Returns the GPUDevice with the specific deviceId.
@ -106,37 +106,31 @@
// Property Name.
public string Name
{
get
{
return GetName();
}
get { return _Name(); }
}
// Property IsStatic.
public bool IsStatic
{
get
{
return IsStaticAxis();
}
get { return IsStaticAxis(); }
}
// Property IsDynamic.
public bool IsDynamic
{
get
{
return IsDynamicAxis();
}
get { return IsDynamicAxis(); }
}
// Property IsOrdered.
public bool IsOrdered
{
get
{
return _IsOrdered();
}
get { return _IsOrdered(); }
}
// Returns index of this Axis.
public int StaticAxisIndex(bool checkStaticAxis = true)
{
return _StaticAxisIndex(checkStaticAxis);
}
// Value equality.
@ -177,11 +171,11 @@
{
if (this.IsDynamicAxis())
{
return this.GetName().GetHashCode();
return this.Name.GetHashCode();
}
else
{
return this.GetStaticAxisIndex().GetHashCode();
return this.StaticAxisIndex(false).GetHashCode();
}
}
%}
@ -191,25 +185,19 @@
// Property Name.
public string Name
{
get
{
return GetName();
}
get { return _Name(); }
}
// Property Uid.
public string Uid
{
get
{
return GetUid();
}
get { return _Uid(); }
}
// Property RootFunction.
public Function RootFunction
{
get { return GetRootFunction(); }
get { return _RootFunction(); }
}
// Property Outputs
@ -228,13 +216,13 @@
// Property Output.
public Variable Output
{
get { return GetOutput(); }
get { return _Output(); }
}
// Property OpName.
public string OpName
{
get { return GetOpName(); }
get { return _OpName(); }
}
// Property IsComposite.
@ -385,19 +373,25 @@
// Property Shape.
public NDShape Shape
{
get { return GetShape(); }
get { return _Shape(); }
}
// Property Name.
public string Name
{
get { return GetName(); }
get { return _Name(); }
}
// Property Uid.
public string Uid
{
get { return _Uid(); }
}
// Property Kind.
public VariableKind Kind
{
get { return GetKind(); }
get { return _Kind(); }
}
// Property DataType.
@ -458,7 +452,7 @@
// Property Owner.
public Function Owner
{
get { return GetOwner(); }
get { return _Owner(); }
}
// Property NeedsGradient.
@ -529,7 +523,7 @@
// Property Rank.
public int Rank
{
get { return (int)GetRank(); }
get { return (int)_Rank(); }
}
// Property Dimensions.
@ -574,7 +568,7 @@
// Property TotalSize.
public int TotalSize
{
get { return (int)GetTotalSize(); }
get { return (int)_TotalSize(); }
}
// Indexer operator
@ -590,17 +584,17 @@
{
throw new System.ArgumentException("The paraemter beginAxisId or endAxisId should not be a negative value");
}
return SubShape((uint)beginAxisId, (uint)endAxisId);
return _SubShape((uint)beginAxisId, (uint)endAxisId);
}
// Returns a subshape.
public NDShape SubShape(int beginAxisId)
public NDShape SubShape(int beginAxisId = 0)
{
if (beginAxisId < 0)
{
throw new System.ArgumentException("The paraemter beginAxisId should not be a negative value");
}
return SubShape((uint)beginAxisId);
return _SubShape((uint)beginAxisId);
}
// Creates a new NDShape.
@ -667,17 +661,17 @@
// Property MaskedCount.
public int MaskedCount {
get { return (int)GetMaskedCount(); }
get { return (int)_MaskedCount(); }
}
// Property Device.
public DeviceDescriptor Device {
get { return GetDevice(); }
get { return _Device(); }
}
// Property Shape.
public NDShape Shape {
get { return GetShape(); }
get { return _Shape(); }
}
// Invidates a section of a NDShape.
@ -704,64 +698,61 @@
// Property Device
public DeviceDescriptor Device
{
get
{
return GetDevice();
}
get { return _Device(); }
}
// Property DataType
public DataType DataType
{
get
{
return GetDataType();
}
get { return GetDataType(); }
}
// Property StorageFormat
public StorageFormat StorgeFormat
{
get
{
return GetStorageFormat();
}
get { return GetStorageFormat(); }
}
// Property Shape
public NDShape Shape
{
get
{
return GetShape();
}
get { return _Shape(); }
}
// Property IsValid
public bool IsValid
{
get { return _IsValid(); }
}
// Property IsSparse
public bool IsSparse
{
get
{
return _IsSparse();
}
get { return _IsSparse(); }
}
// Property IsReadOnly
public bool IsReadOnly
{
get
{
return _IsReadOnly();
}
get { return _IsReadOnly(); }
}
// Property MaskedCount
public int MaskedCount
{
get
{
return (int)_MaskedCount();
}
get { return (int)_MaskedCount(); }
}
// Property Data
public NDArrayView Data
{
get { return _Data(); }
}
// Property Mask
public NDMask Mask
{
get { return _Mask(); }
}
// Create Value object from dense input as batch data.
@ -1309,55 +1300,37 @@
// Property Device.
public DeviceDescriptor Device
{
get
{
return GetDevice();
}
get { return _Device(); }
}
// Property DataType.
public DataType DataType
{
get
{
return GetDataType();
}
get { return GetDataType(); }
}
// Property Shape.
public NDShape Shape
{
get
{
return GetShape();
}
get { return _Shape(); }
}
// Property StorageFormat.
public StorageFormat StorageFormat
{
get
{
return GetStorageFormat();
}
get { return GetStorageFormat(); }
}
// Property IsSparse.
public bool IsSparse
{
get
{
return _IsSparse();
}
get { return _IsSparse(); }
}
// Property IsReadOnly.
public bool IsReadOnly
{
get
{
return _IsReadOnly();
}
get { return _IsReadOnly(); }
}
// Returns a slice view.

Просмотреть файл

@ -73,10 +73,6 @@
%typemap(javacode) CNTK::Axis %{
public boolean isOrdered() {
return _IsOrdered();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
@ -230,18 +226,6 @@
%typemap(javacode) CNTK::NDShape %{
public boolean isUnknown() {
return _IsUnknown();
}
public boolean hasInferredDimension() {
return _HasInferredDimension();
}
public boolean hasFreeDimension() {
return _HasFreeDimension();
}
public java.util.ArrayList<Long> getDimensions(){
java.util.ArrayList<Long> ret = new java.util.ArrayList<Long>((int)getRank());
for (int i = 0; i < _Dimensions().size(); ++i ) {