diff --git a/pytorch/src/main/java/org/bytedeco/pytorch/functions/NamedModuleApplyFunction.java b/pytorch/src/main/java/org/bytedeco/pytorch/functions/NamedModuleApplyFunction.java index ddee7cb7dc8..63558e95a89 100644 --- a/pytorch/src/main/java/org/bytedeco/pytorch/functions/NamedModuleApplyFunction.java +++ b/pytorch/src/main/java/org/bytedeco/pytorch/functions/NamedModuleApplyFunction.java @@ -1,5 +1,6 @@ package org.bytedeco.pytorch.functions; +import org.bytedeco.javacpp.BytePointer; import org.bytedeco.javacpp.FunctionPointer; import org.bytedeco.javacpp.Loader; import org.bytedeco.javacpp.Pointer; @@ -25,5 +26,5 @@ protected NamedModuleApplyFunction() { private native void allocate(); - public native void call(@Const @StdString @ByRef String name, @ByRef Module m); + public native void call(@Const @StdString BytePointer name, @ByRef Module m); } diff --git a/pytorch/src/main/java/org/bytedeco/pytorch/functions/NamedSharedModuleApplyFunction.java b/pytorch/src/main/java/org/bytedeco/pytorch/functions/NamedSharedModuleApplyFunction.java index 36730d521bc..60d59d88319 100644 --- a/pytorch/src/main/java/org/bytedeco/pytorch/functions/NamedSharedModuleApplyFunction.java +++ b/pytorch/src/main/java/org/bytedeco/pytorch/functions/NamedSharedModuleApplyFunction.java @@ -1,5 +1,6 @@ package org.bytedeco.pytorch.functions; +import org.bytedeco.javacpp.BytePointer; import org.bytedeco.javacpp.FunctionPointer; import org.bytedeco.javacpp.Loader; import org.bytedeco.javacpp.Pointer; @@ -25,5 +26,5 @@ protected NamedSharedModuleApplyFunction() { private native void allocate(); - public native void call(@Const @StdString @ByRef String name, @ByRef @SharedPtr @Cast({"", "std::shared_ptr"}) Module m); + public native void call(@Const @StdString BytePointer name, @ByRef @SharedPtr @Cast({"", "std::shared_ptr"}) Module m); } diff --git a/pytorch/src/main/java/org/bytedeco/pytorch/functions/PickleWriter.java b/pytorch/src/main/java/org/bytedeco/pytorch/functions/PickleWriter.java index 8d869911a3f..016ef57108b 100644 --- a/pytorch/src/main/java/org/bytedeco/pytorch/functions/PickleWriter.java +++ b/pytorch/src/main/java/org/bytedeco/pytorch/functions/PickleWriter.java @@ -27,5 +27,5 @@ protected PickleWriter() { private native void allocate(); - public native void call(@Cast("const char *") BytePointer buf, @Cast("size_t") long nbytes); + public native void call(@Cast("const char*") BytePointer buf, @Cast("size_t") long nbytes); } diff --git a/pytorch/src/main/java/org/bytedeco/pytorch/functions/StringConsumer.java b/pytorch/src/main/java/org/bytedeco/pytorch/functions/StringConsumer.java index 8672e03e86d..2a04e6cc844 100644 --- a/pytorch/src/main/java/org/bytedeco/pytorch/functions/StringConsumer.java +++ b/pytorch/src/main/java/org/bytedeco/pytorch/functions/StringConsumer.java @@ -1,9 +1,10 @@ package org.bytedeco.pytorch.functions; +import org.bytedeco.javacpp.BytePointer; import org.bytedeco.javacpp.FunctionPointer; import org.bytedeco.javacpp.Loader; import org.bytedeco.javacpp.Pointer; -import org.bytedeco.javacpp.annotation.Cast; +import org.bytedeco.javacpp.annotation.Const; import org.bytedeco.javacpp.annotation.Properties; import org.bytedeco.javacpp.annotation.StdString; @@ -26,5 +27,6 @@ protected StringConsumer() { private native void allocate(); - public native void call(@Cast({"", "const std::string&"}) @StdString String s); + // std::function + public native void call(@Const @StdString BytePointer s); } diff --git a/pytorch/src/main/java/org/bytedeco/pytorch/functions/StringSupplier.java b/pytorch/src/main/java/org/bytedeco/pytorch/functions/StringSupplier.java index 6a2ae3fd6ec..b61b6fd61b2 100644 --- a/pytorch/src/main/java/org/bytedeco/pytorch/functions/StringSupplier.java +++ b/pytorch/src/main/java/org/bytedeco/pytorch/functions/StringSupplier.java @@ -1,8 +1,10 @@ package org.bytedeco.pytorch.functions; +import org.bytedeco.javacpp.BytePointer; import org.bytedeco.javacpp.FunctionPointer; import org.bytedeco.javacpp.Loader; import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.Cast; import org.bytedeco.javacpp.annotation.Properties; import org.bytedeco.javacpp.annotation.StdString; @@ -25,5 +27,6 @@ protected StringSupplier() { private native void allocate(); - public native @StdString String call(); + // Without the cast, the function returns a std::basic_string& and the cast from StringAdapter returns a reference to a variable in the stack. + public native @StdString @Cast({"", "char*"}) BytePointer call(); } diff --git a/pytorch/src/main/java/org/bytedeco/pytorch/functions/TensorIdGetter.java b/pytorch/src/main/java/org/bytedeco/pytorch/functions/TensorIdGetter.java index 1951df6a037..dd5dc371a3a 100644 --- a/pytorch/src/main/java/org/bytedeco/pytorch/functions/TensorIdGetter.java +++ b/pytorch/src/main/java/org/bytedeco/pytorch/functions/TensorIdGetter.java @@ -27,5 +27,6 @@ protected TensorIdGetter() { private native void allocate(); // std::function - public native @StdString String call(@Const @ByRef Tensor tensor); + // Without the cast, the function returns a std::basic_string& and the cast from StringAdapter returns a reference to a variable in the stack. + public native @StdString @Cast({"", "char*"}) BytePointer call(@Const @ByRef Tensor tensor); }