Java源码示例:org.bytedeco.javacpp.tools.InfoMap
示例1
public void map(InfoMap infoMap) {
infoMap.put(new Info("TF_CAPI_EXPORT").cppTypes().annotations())
.put(new Info("TF_Buffer::data").javaText("public native @Const Pointer data(); public native TF_Buffer data(Pointer data);"))
.put(new Info("TF_Status").pointerTypes("TF_Status").base("org.tensorflow.internal.c_api.AbstractTF_Status"))
.put(new Info("TF_Buffer").pointerTypes("TF_Buffer").base("org.tensorflow.internal.c_api.AbstractTF_Buffer"))
.put(new Info("TF_Tensor").pointerTypes("TF_Tensor").base("org.tensorflow.internal.c_api.AbstractTF_Tensor"))
.put(new Info("TF_Session").pointerTypes("TF_Session").base("org.tensorflow.internal.c_api.AbstractTF_Session"))
.put(new Info("TF_SessionOptions").pointerTypes("TF_SessionOptions").base("org.tensorflow.internal.c_api.AbstractTF_SessionOptions"))
.put(new Info("TF_Graph").pointerTypes("TF_Graph").base("org.tensorflow.internal.c_api.AbstractTF_Graph"))
.put(new Info("TF_Graph::graph").javaText("public native @MemberGetter @ByRef Graph graph();"))
.put(new Info("TF_Graph::refiner").javaText("public native @MemberGetter @ByRef ShapeRefiner refiner();"))
.put(new Info("TF_ImportGraphDefOptions").pointerTypes("TF_ImportGraphDefOptions").base("org.tensorflow.internal.c_api.AbstractTF_ImportGraphDefOptions"))
.put(new Info("TF_Operation", "TF_WhileParams", "TFE_MonitoringCounterCell", "TFE_MonitoringSamplerCell",
"TFE_MonitoringCounter0", "TFE_MonitoringCounter1", "TFE_MonitoringCounter2",
"TFE_MonitoringIntGaugeCell", "TFE_MonitoringStringGaugeCell", "TFE_MonitoringBoolGaugeCell",
"TFE_MonitoringIntGauge0", "TFE_MonitoringIntGauge1", "TFE_MonitoringIntGauge2",
"TFE_MonitoringStringGauge0", "TFE_MonitoringStringGauge1", "TFE_MonitoringStringGauge2",
"TFE_MonitoringBoolGauge0", "TFE_MonitoringBoolGauge1", "TFE_MonitoringBoolGauge2",
"TFE_MonitoringSampler0", "TFE_MonitoringSampler1", "TFE_MonitoringSampler2").purify())
.put(new Info("TF_Operation::node").javaText("public native @MemberGetter @ByRef Node node();"))
.put(new Info("TFE_MonitoringCounterCell::cell").javaText("public native @MemberGetter @ByRef CounterCell cell();"))
.put(new Info("TFE_MonitoringSamplerCell::cell").javaText("public native @MemberGetter @ByRef SamplerCell cell();"))
.put(new Info("TFE_MonitoringIntGaugeCell::cell").javaText("public native @MemberGetter @ByRef IntGaugeCell cell();"))
.put(new Info("TFE_MonitoringStringGaugeCell::cell").javaText("public native @MemberGetter @ByRef StringGaugeCell cell();"))
.put(new Info("TFE_MonitoringBoolGaugeCell::cell").javaText("public native @MemberGetter @ByRef BoolGaugeCell cell();"))
.put(new Info("TFE_Context").pointerTypes("TFE_Context").base("org.tensorflow.internal.c_api.AbstractTFE_Context"))
.put(new Info("TFE_ContextOptions").pointerTypes("TFE_ContextOptions").base("org.tensorflow.internal.c_api.AbstractTFE_ContextOptions"))
.put(new Info("TFE_Context::context").javaText("@MemberGetter public native @ByRef EagerContext context();"))
.put(new Info("TFE_Op").pointerTypes("TFE_Op").base("org.tensorflow.internal.c_api.AbstractTFE_Op"))
.put(new Info("TFE_Op::operation").javaText("@MemberGetter public native @ByRef EagerOperation operation();"))
.put(new Info("TFE_TensorHandle").pointerTypes("TFE_TensorHandle").base("org.tensorflow.internal.c_api.AbstractTFE_TensorHandle"))
.put(new Info("TF_ShapeInferenceContextDimValueKnown", "TFE_NewTensorHandle(const tensorflow::Tensor&, TF_Status*)").skip());
}
示例2
@Override
public void map(InfoMap infoMap) {
infoMap.put(new Info("thread_local", "ND4J_EXPORT", "INLINEDEF", "CUBLASWINAPI", "FORCEINLINE", "_CUDA_H", "_CUDA_D", "_CUDA_G", "_CUDA_HD", "LIBND4J_ALL_OPS", "NOT_EXCLUDED").cppTypes().annotations())
.put(new Info("NativeOps").base("org.nd4j.nativeblas.NativeOps"))
.put(new Info("char").valueTypes("char").pointerTypes("@Cast(\"char*\") String",
"@Cast(\"char*\") BytePointer"))
.put(new Info("Nd4jPointer").cast().valueTypes("Pointer").pointerTypes("PointerPointer"))
.put(new Info("Nd4jLong").cast().valueTypes("long").pointerTypes("LongPointer", "LongBuffer",
"long[]"))
.put(new Info("Nd4jStatus").cast().valueTypes("int").pointerTypes("IntPointer", "IntBuffer",
"int[]"))
.put(new Info("float16").cast().valueTypes("short").pointerTypes("ShortPointer", "ShortBuffer",
"short[]"));
infoMap.put(new Info("__CUDACC__").define(false))
.put(new Info("__JAVACPP_HACK__").define(true))
.put(new Info("LIBND4J_ALL_OPS").define(true))
.put(new Info("MAX_UINT").translate(false))
.put(new Info("std::initializer_list", "cnpy::NpyArray", "nd4j::NDArray::applyLambda", "nd4j::NDArray::applyPairwiseLambda",
"nd4j::graph::FlatResult", "nd4j::graph::FlatVariable").skip())
.put(new Info("std::string").annotations("@StdString").valueTypes("BytePointer", "String")
.pointerTypes("@Cast({\"char*\", \"std::string*\"}) BytePointer"))
.put(new Info("std::pair<int,int>").pointerTypes("IntIntPair").define())
.put(new Info("std::vector<std::vector<int> >").pointerTypes("IntVectorVector").define())
.put(new Info("std::vector<std::vector<Nd4jLong> >").pointerTypes("LongVectorVector").define())
.put(new Info("std::vector<nd4j::NDArray<float>*>").pointerTypes("FloatNDArrayVector").define())
.put(new Info("std::vector<nd4j::NDArray<float16>*>").pointerTypes("HalfNDArrayVector").define())
.put(new Info("std::vector<nd4j::NDArray<double>*>").pointerTypes("DoubleNDArrayVector").define())
.put(new Info("nd4j::IndicesList").purify());
String classTemplates[] = {
"nd4j::NDArray",
"nd4j::NDArrayList",
"nd4j::ResultSet",
"nd4j::graph::GraphState",
"nd4j::NDArrayFactory",
"nd4j::graph::Variable",
"nd4j::graph::VariablesSet",
"nd4j::graph::Stash",
"nd4j::graph::VariableSpace",
"nd4j::graph::Context",
"nd4j::graph::ContextPrototype",
"nd4j::ops::DeclarableOp",
"nd4j::ops::DeclarableListOp",
"nd4j::ops::DeclarableReductionOp",
"nd4j::ops::DeclarableCustomOp",
"nd4j::ops::BooleanOp",
"nd4j::ops::LogicOp"};
for (String t : classTemplates) {
String s = t.substring(t.lastIndexOf(':') + 1);
infoMap.put(new Info(t + "<float>").pointerTypes("Float" + s))
.put(new Info(t + "<float16>").pointerTypes("Half" + s))
.put(new Info(t + "<double>").pointerTypes("Double" + s));
}
infoMap.put(new Info("nd4j::ops::OpRegistrator::updateMSVC").skip());
}
示例3
@Override
public void map(InfoMap infoMap) {
infoMap.put(new Info("thread_local", "ND4J_EXPORT", "INLINEDEF", "CUBLASWINAPI", "FORCEINLINE",
"_CUDA_H", "_CUDA_D", "_CUDA_G", "_CUDA_HD", "LIBND4J_ALL_OPS", "NOT_EXCLUDED").cppTypes().annotations())
.put(new Info("NativeOps.h").objectify())
.put(new Info("OpaqueTadPack").pointerTypes("OpaqueTadPack"))
.put(new Info("OpaqueResultWrapper").pointerTypes("OpaqueResultWrapper"))
.put(new Info("OpaqueShapeList").pointerTypes("OpaqueShapeList"))
.put(new Info("OpaqueVariablesSet").pointerTypes("OpaqueVariablesSet"))
.put(new Info("OpaqueVariable").pointerTypes("OpaqueVariable"))
.put(new Info("OpaqueConstantDataBuffer").pointerTypes("OpaqueConstantDataBuffer"))
.put(new Info("OpaqueConstantShapeBuffer").pointerTypes("OpaqueConstantShapeBuffer"))
.put(new Info("OpaqueConstantOffsetsBuffer").pointerTypes("OpaqueConstantOffsetsBuffer"))
.put(new Info("OpaqueContext").pointerTypes("OpaqueContext"))
.put(new Info("OpaqueRandomGenerator").pointerTypes("OpaqueRandomGenerator"))
.put(new Info("OpaqueLaunchContext").pointerTypes("OpaqueLaunchContext"))
.put(new Info("OpaqueDataBuffer").pointerTypes("OpaqueDataBuffer"))
.put(new Info("const char").valueTypes("byte").pointerTypes("@Cast(\"char*\") String",
"@Cast(\"char*\") BytePointer"))
.put(new Info("char").valueTypes("char").pointerTypes("@Cast(\"char*\") BytePointer",
"@Cast(\"char*\") String"))
.put(new Info("Nd4jPointer").cast().valueTypes("Pointer").pointerTypes("PointerPointer"))
.put(new Info("Nd4jLong").cast().valueTypes("long").pointerTypes("LongPointer", "LongBuffer",
"long[]"))
.put(new Info("Nd4jStatus").cast().valueTypes("int").pointerTypes("IntPointer", "IntBuffer",
"int[]"))
.put(new Info("float16").cast().valueTypes("short").pointerTypes("ShortPointer", "ShortBuffer",
"short[]"))
.put(new Info("bfloat16").cast().valueTypes("short").pointerTypes("ShortPointer", "ShortBuffer",
"short[]"));
infoMap.put(new Info("__CUDACC__", "MAX_UINT", "HAVE_MKLDNN").define(false))
.put(new Info("__JAVACPP_HACK__", "LIBND4J_ALL_OPS","__CUDABLAS__").define(true))
.put(new Info("std::initializer_list", "cnpy::NpyArray", "sd::NDArray::applyLambda", "sd::NDArray::applyPairwiseLambda",
"sd::graph::FlatResult", "sd::graph::FlatVariable", "sd::NDArray::subarray", "std::shared_ptr", "sd::PointerWrapper", "sd::PointerDeallocator").skip())
.put(new Info("std::string").annotations("@StdString").valueTypes("BytePointer", "String")
.pointerTypes("@Cast({\"char*\", \"std::string*\"}) BytePointer"))
.put(new Info("std::pair<int,int>").pointerTypes("IntIntPair").define())
.put(new Info("std::vector<std::vector<int> >").pointerTypes("IntVectorVector").define())
.put(new Info("std::vector<std::vector<Nd4jLong> >").pointerTypes("LongVectorVector").define())
.put(new Info("std::vector<sd::NDArray*>").pointerTypes("NDArrayVector").define())
.put(new Info("std::vector<const sd::NDArray*>").pointerTypes("ConstNDArrayVector").define())
.put(new Info("bool").cast().valueTypes("boolean").pointerTypes("BooleanPointer", "boolean[]"))
.put(new Info("sd::graph::ResultWrapper").base("org.nd4j.nativeblas.ResultWrapperAbstraction").define())
.put(new Info("sd::IndicesList").purify());
/*
String classTemplates[] = {
"sd::NDArray",
"sd::NDArrayList",
"sd::ResultSet",
"sd::OpArgsHolder",
"sd::graph::GraphState",
"sd::graph::Variable",
"sd::graph::VariablesSet",
"sd::graph::Stash",
"sd::graph::VariableSpace",
"sd::graph::Context",
"sd::graph::ContextPrototype",
"sd::ops::DeclarableOp",
"sd::ops::DeclarableListOp",
"sd::ops::DeclarableReductionOp",
"sd::ops::DeclarableCustomOp",
"sd::ops::BooleanOp",
"sd::ops::BroadcastableOp",
"sd::ops::LogicOp"};
for (String t : classTemplates) {
String s = t.substring(t.lastIndexOf(':') + 1);
infoMap.put(new Info(t + "<float>").pointerTypes("Float" + s))
.put(new Info(t + "<float16>").pointerTypes("Half" + s))
.put(new Info(t + "<double>").pointerTypes("Double" + s));
}
*/
infoMap.put(new Info("sd::ops::OpRegistrator::updateMSVC").skip());
}