Skip to content

Commit

Permalink
Add item_byte and data_ptr_bool
Browse files Browse the repository at this point in the history
  • Loading branch information
HGuillemet committed Nov 3, 2023
1 parent 49668cb commit 2dfcc32
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions pytorch/src/gen/java/org/bytedeco/pytorch/Tensor.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ private native void allocate(
public native @Name("item<int16_t>") short item_short();

public native @Name("item<int>") int item_int();
public native @Name("item<int>") int item_byte();

public native @Cast("int64_t") @Name("item<int64_t>") long item_long();

Expand Down
1 change: 1 addition & 0 deletions pytorch/src/gen/java/org/bytedeco/pytorch/TensorBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ private native void allocate(
// TODO(#97856) Make this return a const pointer. This is currently
// const because of the vast number of clients that
// rely on this.
public native @Cast("bool*") @Name("data_ptr<bool>") BoolPointer data_ptr_bool();
public native @Name("data_ptr<int8_t>") BytePointer data_ptr_char();
public native @Cast("uint8_t*") @Name("data_ptr<uint8_t>") BytePointer data_ptr_byte();
public native @Name("data_ptr<int16_t>") ShortPointer data_ptr_short();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,7 @@ We need either to put an annotation info on each member, or javaName("@NoOffset
+ "@Namespace(\"c10_complex_math\") public static native @ByVal @Name(\"pow<float,double>\") DoubleComplex pow(@Const @ByRef float x, @Const @ByRef DoubleComplex y);\n"
))
.put(new Info("c10::util::get_type_index<std::string>").javaNames("get_type_index_string"))
.put(new Info("at::TensorBase::data_ptr<bool>").javaNames("data_ptr_bool"))
.put(new Info("at::TensorBase::data_ptr<int8_t>").javaNames("data_ptr_char"))
.put(new Info("at::TensorBase::data_ptr<uint8_t>").javaNames("data_ptr_byte"))
.put(new Info("at::TensorBase::data_ptr<int16_t>").javaNames("data_ptr_short"))
Expand All @@ -1968,7 +1969,11 @@ We need either to put an annotation info on each member, or javaName("@NoOffset
.put(new Info("at::Tensor::item<bool>").javaNames("item_bool"))
.put(new Info("at::Tensor::item<int8_t>").javaNames("item_char"))
.put(new Info("at::Tensor::item<int16_t>").javaNames("item_short"))
.put(new Info("at::Tensor::item<int>").javaNames("item_int"))
// Since we don't have uint8 in Java, make item_byte an alias of item_int
.put(new Info("at::Tensor::item<int>").javaText(
"public native @Name(\"item<int>\") int item_int();\n" +
"public native @Name(\"item<int>\") int item_byte();"
))
.put(new Info("at::Tensor::item<int64_t>").javaNames("item_long"))
.put(new Info("at::Tensor::item<float>").javaNames("item_float"))
.put(new Info("at::Tensor::item<double>").javaNames("item_double"))
Expand Down

0 comments on commit 2dfcc32

Please sign in to comment.