make Clone/FindByName/FindAllWithName also private

make more methods private; add missing methods to C#
This commit is contained in:
Zhou Wang 2017-05-16 13:04:57 +02:00
Родитель bd6ac0271c
Коммит 97289654e1
2 изменённых файлов: 70 добавлений и 3 удалений

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

@ -468,6 +468,7 @@ RENAME_AND_MAKE_PRIVATE(CNTK::Axis, IsOrdered);
// class Function
%ignore CNTK::Function::BlockArgumentsMapping;
%ignore CNTK::GetCorrespondingOutputVariableFromClone;
MAKE_GETTER(CNTK::Function, Name);
MAKE_GETTER(CNTK::Function, Uid);
MAKE_GETTER(CNTK::Function, RootFunction);
@ -496,11 +497,14 @@ RENAME_AND_MAKE_PRIVATE(CNTK::Function, Clone);
%rename (toString) CNTK::Function::AsString;
#endif
// 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());
%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;
@ -536,6 +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);
@ -572,6 +577,29 @@ RENAME_AND_MAKE_PRIVATE(CNTK::NDShape, HasFreeDimension);
%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;
@ -583,6 +611,7 @@ 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.
@ -651,6 +680,11 @@ RENAME_AND_MAKE_PRIVATE(CNTK::Value, IsValid);
%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"
@ -660,6 +694,10 @@ 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);
#ifdef SWIGCSHARP
%rename_and_make_private(CNTK::NDArrayView, Alias);
#endif
%extend CNTK::NDArrayView {
NDArrayView(const NDShape& viewShape, float *dataBuffer, size_t numBufferElements, const DeviceDescriptor& device, bool readOnly = false)
{

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

@ -325,6 +325,12 @@
}
}
// Find the function with the specified name.
public Function FindByName(string name, bool nestedSearchInsideBlockFunction = false)
{
return _FindByName(name, nestedSearchInsideBlockFunction);
}
// Finds all functions inside this Functions having the specified name.
public System.Collections.Generic.IList<Function> FindAllWithName(string name, bool nestedSearchInsideBlockFunction = false)
{
@ -455,6 +461,12 @@
get { return GetOwner(); }
}
// Property NeedsGradient.
public bool NeedsGradient
{
get { return _NeedsGradient(); }
}
// Value equality.
public override bool Equals(System.Object obj)
{
@ -553,6 +565,12 @@
get { return _HasFreeDimension(); }
}
// Property HasUnboundDimension.
public bool HasUnboundDimension
{
get { return _HasUnboundDimension(); }
}
// Property TotalSize.
public int TotalSize
{
@ -1242,6 +1260,11 @@
return;
}
// Creates a new Value which is an alias of this Value.
public Value Alias(bool readOnly = false)
{
return _Alias(readOnly);
}
%}
@ -1346,6 +1369,12 @@
return _SliceView(startOffsetVector, extentVector, readOnly);
}
// Creates a new NDArrayView which is an alias of this NDArrayView.
public NDArrayView Alias(bool readOnly = false)
{
return _Alias(readOnly);
}
%}
%include "CNTKLibraryInternals.h"