Skip to content

Commit

Permalink
Map instances of c10::variant<...> options for PyTorch
Browse files Browse the repository at this point in the history
  • Loading branch information
saudet committed Jun 22, 2021
1 parent 1ffb7f9 commit 7b9ccf3
Show file tree
Hide file tree
Showing 64 changed files with 936 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ public class BCELossOptions extends Pointer {
}

public native @ByRef @NoException Tensor weight();
public native @Cast("torch::nn::BCELossOptions::reduction_t*") @ByRef @NoException Pointer reduction();
public native @ByRef @NoException loss_reduction_t reduction();
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ public class BCEWithLogitsLossOptions extends Pointer {
}

public native @ByRef @NoException Tensor weight();
public native @Cast("torch::nn::BCEWithLogitsLossOptions::reduction_t*") @ByRef @NoException Pointer reduction();
public native @ByRef @NoException loss_reduction_t reduction();
public native @ByRef @NoException Tensor pos_weight();
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ public class CTCLossOptions extends Pointer {
}

public native @Cast("int64_t*") @ByRef @NoException LongPointer blank();
public native @Cast("torch::nn::CTCLossOptions::reduction_t*") @ByRef @NoException Pointer reduction();
public native @ByRef @NoException loss_reduction_t reduction();
public native @Cast("bool*") @ByRef @NoException BoolPointer zero_infinity();
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class Conv1dFuncOptions extends Pointer {

public native @ByRef @NoException Tensor bias();
public native @Cast("torch::ExpandingArray<1>*") @ByRef @NoException LongPointer stride();
public native @Cast("torch::nn::functional::ConvFuncOptions<1>::padding_t*") @ByRef @NoException Pointer padding();
public native @ByRef @NoException conv_padding_t1 padding();
public native @Cast("torch::ExpandingArray<1>*") @ByRef @NoException LongPointer dilation();
public native @Cast("int64_t*") @ByRef @NoException LongPointer groups();
}
4 changes: 2 additions & 2 deletions pytorch/src/gen/java/org/bytedeco/pytorch/Conv1dOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ private native void allocate(
public native @Cast("int64_t*") @ByRef @NoException LongPointer out_channels();
public native @Cast("torch::ExpandingArray<1>*") @ByRef @NoException LongPointer kernel_size();
public native @Cast("torch::ExpandingArray<1>*") @ByRef @NoException LongPointer stride();
public native @Cast("torch::nn::ConvOptions<1>::padding_t*") @ByRef @NoException Pointer padding();
public native @ByRef @NoException conv_padding_t1 padding();
public native @Cast("torch::ExpandingArray<1>*") @ByRef @NoException LongPointer dilation();
public native @Cast("int64_t*") @ByRef @NoException LongPointer groups();
public native @Cast("bool*") @ByRef @NoException BoolPointer bias();
public native @Cast("torch::nn::ConvOptions<1>::padding_mode_t*") @ByRef @NoException Pointer padding_mode();
public native @ByRef @NoException conv_padding_mode_t padding_mode();
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class Conv2dFuncOptions extends Pointer {

public native @ByRef @NoException Tensor bias();
public native @Cast("torch::ExpandingArray<2>*") @ByRef @NoException LongPointer stride();
public native @Cast("torch::nn::functional::ConvFuncOptions<2>::padding_t*") @ByRef @NoException Pointer padding();
public native @ByRef @NoException conv_padding_t2 padding();
public native @Cast("torch::ExpandingArray<2>*") @ByRef @NoException LongPointer dilation();
public native @Cast("int64_t*") @ByRef @NoException LongPointer groups();
}
4 changes: 2 additions & 2 deletions pytorch/src/gen/java/org/bytedeco/pytorch/Conv2dOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ private native void allocate(
public native @Cast("int64_t*") @ByRef @NoException LongPointer out_channels();
public native @Cast("torch::ExpandingArray<2>*") @ByRef @NoException LongPointer kernel_size();
public native @Cast("torch::ExpandingArray<2>*") @ByRef @NoException LongPointer stride();
public native @Cast("torch::nn::ConvOptions<2>::padding_t*") @ByRef @NoException Pointer padding();
public native @ByRef @NoException conv_padding_t2 padding();
public native @Cast("torch::ExpandingArray<2>*") @ByRef @NoException LongPointer dilation();
public native @Cast("int64_t*") @ByRef @NoException LongPointer groups();
public native @Cast("bool*") @ByRef @NoException BoolPointer bias();
public native @Cast("torch::nn::ConvOptions<2>::padding_mode_t*") @ByRef @NoException Pointer padding_mode();
public native @ByRef @NoException conv_padding_mode_t padding_mode();
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class Conv3dFuncOptions extends Pointer {

public native @ByRef @NoException Tensor bias();
public native @Cast("torch::ExpandingArray<3>*") @ByRef @NoException LongPointer stride();
public native @Cast("torch::nn::functional::ConvFuncOptions<3>::padding_t*") @ByRef @NoException Pointer padding();
public native @ByRef @NoException conv_padding_t3 padding();
public native @Cast("torch::ExpandingArray<3>*") @ByRef @NoException LongPointer dilation();
public native @Cast("int64_t*") @ByRef @NoException LongPointer groups();
}
4 changes: 2 additions & 2 deletions pytorch/src/gen/java/org/bytedeco/pytorch/Conv3dOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ private native void allocate(
public native @Cast("int64_t*") @ByRef @NoException LongPointer out_channels();
public native @Cast("torch::ExpandingArray<3>*") @ByRef @NoException LongPointer kernel_size();
public native @Cast("torch::ExpandingArray<3>*") @ByRef @NoException LongPointer stride();
public native @Cast("torch::nn::ConvOptions<3>::padding_t*") @ByRef @NoException Pointer padding();
public native @ByRef @NoException conv_padding_t3 padding();
public native @Cast("torch::ExpandingArray<3>*") @ByRef @NoException LongPointer dilation();
public native @Cast("int64_t*") @ByRef @NoException LongPointer groups();
public native @Cast("bool*") @ByRef @NoException BoolPointer bias();
public native @Cast("torch::nn::ConvOptions<3>::padding_mode_t*") @ByRef @NoException Pointer padding_mode();
public native @ByRef @NoException conv_padding_mode_t padding_mode();
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ private native void allocate(
public native @Cast("int64_t*") @ByRef @NoException LongPointer groups();
public native @Cast("bool*") @ByRef @NoException BoolPointer bias();
public native @Cast("torch::ExpandingArray<1>*") @ByRef @NoException LongPointer dilation();
public native @Cast("torch::nn::ConvTransposeOptions<1>::padding_mode_t*") @ByRef @NoException Pointer padding_mode();
public native @ByRef @NoException conv_padding_mode_t padding_mode();
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ private native void allocate(
public native @Cast("int64_t*") @ByRef @NoException LongPointer groups();
public native @Cast("bool*") @ByRef @NoException BoolPointer bias();
public native @Cast("torch::ExpandingArray<2>*") @ByRef @NoException LongPointer dilation();
public native @Cast("torch::nn::ConvTransposeOptions<2>::padding_mode_t*") @ByRef @NoException Pointer padding_mode();
public native @ByRef @NoException conv_padding_mode_t padding_mode();
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ private native void allocate(
public native @Cast("int64_t*") @ByRef @NoException LongPointer groups();
public native @Cast("bool*") @ByRef @NoException BoolPointer bias();
public native @Cast("torch::ExpandingArray<3>*") @ByRef @NoException LongPointer dilation();
public native @Cast("torch::nn::ConvTransposeOptions<3>::padding_mode_t*") @ByRef @NoException Pointer padding_mode();
public native @ByRef @NoException conv_padding_mode_t padding_mode();
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ public class CosineEmbeddingLossOptions extends Pointer {
}

public native @ByRef @NoException DoublePointer margin();
public native @Cast("torch::nn::CosineEmbeddingLossOptions::reduction_t*") @ByRef @NoException Pointer reduction();
public native @ByRef @NoException loss_reduction_t reduction();
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ public class CrossEntropyLossOptions extends Pointer {

public native @ByRef @NoException Tensor weight();
public native @Cast("int64_t*") @ByRef @NoException LongPointer ignore_index();
public native @Cast("torch::nn::CrossEntropyLossOptions::reduction_t*") @ByRef @NoException Pointer reduction();
public native @ByRef @NoException loss_reduction_t reduction();
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ private native void allocate(
public native @Cast("int64_t*") @ByRef @NoException LongPointer out_channels();
public native @Cast("torch::ExpandingArray<1>*") @ByRef @NoException LongPointer kernel_size();
public native @Cast("torch::ExpandingArray<1>*") @ByRef @NoException LongPointer stride();
public native @Cast("torch::nn::detail::ConvNdOptions<1>::padding_t*") @ByRef @NoException Pointer padding();
public native @ByRef @NoException conv_padding_t1 padding();
public native @Cast("torch::ExpandingArray<1>*") @ByRef @NoException LongPointer dilation();
public native @Cast("bool*") @ByRef @NoException BoolPointer transposed();
public native @Cast("torch::ExpandingArray<1>*") @ByRef @NoException LongPointer output_padding();
public native @Cast("int64_t*") @ByRef @NoException LongPointer groups();
public native @Cast("bool*") @ByRef @NoException BoolPointer bias();
public native @Cast("torch::nn::detail::conv_padding_mode_t*") @ByRef @NoException Pointer padding_mode();
public native @ByRef @NoException conv_padding_mode_t padding_mode();
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ private native void allocate(
public native @Cast("int64_t*") @ByRef @NoException LongPointer out_channels();
public native @Cast("torch::ExpandingArray<2>*") @ByRef @NoException LongPointer kernel_size();
public native @Cast("torch::ExpandingArray<2>*") @ByRef @NoException LongPointer stride();
public native @Cast("torch::nn::detail::ConvNdOptions<2>::padding_t*") @ByRef @NoException Pointer padding();
public native @ByRef @NoException conv_padding_t2 padding();
public native @Cast("torch::ExpandingArray<2>*") @ByRef @NoException LongPointer dilation();
public native @Cast("bool*") @ByRef @NoException BoolPointer transposed();
public native @Cast("torch::ExpandingArray<2>*") @ByRef @NoException LongPointer output_padding();
public native @Cast("int64_t*") @ByRef @NoException LongPointer groups();
public native @Cast("bool*") @ByRef @NoException BoolPointer bias();
public native @Cast("torch::nn::detail::conv_padding_mode_t*") @ByRef @NoException Pointer padding_mode();
public native @ByRef @NoException conv_padding_mode_t padding_mode();
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ private native void allocate(
public native @Cast("int64_t*") @ByRef @NoException LongPointer out_channels();
public native @Cast("torch::ExpandingArray<3>*") @ByRef @NoException LongPointer kernel_size();
public native @Cast("torch::ExpandingArray<3>*") @ByRef @NoException LongPointer stride();
public native @Cast("torch::nn::detail::ConvNdOptions<3>::padding_t*") @ByRef @NoException Pointer padding();
public native @ByRef @NoException conv_padding_t3 padding();
public native @Cast("torch::ExpandingArray<3>*") @ByRef @NoException LongPointer dilation();
public native @Cast("bool*") @ByRef @NoException BoolPointer transposed();
public native @Cast("torch::ExpandingArray<3>*") @ByRef @NoException LongPointer output_padding();
public native @Cast("int64_t*") @ByRef @NoException LongPointer groups();
public native @Cast("bool*") @ByRef @NoException BoolPointer bias();
public native @Cast("torch::nn::detail::conv_padding_mode_t*") @ByRef @NoException Pointer padding_mode();
public native @ByRef @NoException conv_padding_mode_t padding_mode();
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class EmbeddingBagFromPretrainedOptions extends Pointer {
public native @ByRef @NoException DoubleOptional max_norm();
public native @ByRef @NoException DoublePointer norm_type();
public native @Cast("bool*") @ByRef @NoException BoolPointer scale_grad_by_freq();
public native @Cast("torch::nn::EmbeddingBagMode*") @ByRef @NoException Pointer mode();
public native @ByRef @NoException EmbeddingBagMode mode();
public native @Cast("bool*") @ByRef @NoException BoolPointer sparse();
public native @Cast("bool*") @ByRef @NoException BoolPointer include_last_offset();
public native @ByRef @NoException LongOptional padding_idx();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class EmbeddingBagFuncOptions extends Pointer {
public native @ByRef @NoException DoubleOptional max_norm();
public native @ByRef @NoException DoublePointer norm_type();
public native @Cast("bool*") @ByRef @NoException BoolPointer scale_grad_by_freq();
public native @Cast("torch::nn::EmbeddingBagMode*") @ByRef @NoException Pointer mode();
public native @ByRef @NoException EmbeddingBagMode mode();
public native @Cast("bool*") @ByRef @NoException BoolPointer sparse();
public native @ByRef @NoException Tensor per_sample_weights();
public native @Cast("bool*") @ByRef @NoException BoolPointer include_last_offset();
Expand Down
40 changes: 40 additions & 0 deletions pytorch/src/gen/java/org/bytedeco/pytorch/EmbeddingBagMode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.pytorch;

import org.bytedeco.pytorch.Allocator;
import org.bytedeco.pytorch.Function;
import org.bytedeco.pytorch.Module;
import java.nio.*;
import org.bytedeco.javacpp.*;
import org.bytedeco.javacpp.annotation.*;

import static org.bytedeco.javacpp.presets.javacpp.*;
import static org.bytedeco.openblas.global.openblas_nolapack.*;
import static org.bytedeco.openblas.global.openblas.*;

import static org.bytedeco.pytorch.global.torch.*;

@NoOffset @Name("c10::variant<torch::enumtype::kSum,torch::enumtype::kMean,torch::enumtype::kMax>") @Properties(inherit = org.bytedeco.pytorch.presets.torch.class)
public class EmbeddingBagMode extends Pointer {
static { Loader.load(); }
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public EmbeddingBagMode(Pointer p) { super(p); }
public EmbeddingBagMode(kSum value) { this(); put(value); }
public EmbeddingBagMode(kMean value) { this(); put(value); }
public EmbeddingBagMode(kMax value) { this(); put(value); }
public EmbeddingBagMode() { allocate(); }
private native void allocate();
public native @Name("operator =") @ByRef EmbeddingBagMode put(@ByRef EmbeddingBagMode x);

public @ByRef kSum get0() { return get0(this); }
@Namespace @Name("c10::get<0>") public static native @ByRef kSum get0(@ByRef EmbeddingBagMode container);
@ValueSetter public native EmbeddingBagMode put(@ByRef kSum value);
public @ByRef kMean get1() { return get1(this); }
@Namespace @Name("c10::get<1>") public static native @ByRef kMean get1(@ByRef EmbeddingBagMode container);
@ValueSetter public native EmbeddingBagMode put(@ByRef kMean value);
public @ByRef kMax get2() { return get2(this); }
@Namespace @Name("c10::get<2>") public static native @ByRef kMax get2(@ByRef EmbeddingBagMode container);
@ValueSetter public native EmbeddingBagMode put(@ByRef kMax value);
}

Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class EmbeddingBagOptions extends Pointer {
public native @ByRef @NoException DoubleOptional max_norm();
public native @ByRef @NoException DoublePointer norm_type();
public native @Cast("bool*") @ByRef @NoException BoolPointer scale_grad_by_freq();
public native @Cast("torch::nn::EmbeddingBagMode*") @ByRef @NoException Pointer mode();
public native @ByRef @NoException EmbeddingBagMode mode();
public native @Cast("bool*") @ByRef @NoException BoolPointer sparse();
public native @ByRef @NoException Tensor _weight();
public native @Cast("bool*") @ByRef @NoException BoolPointer include_last_offset();
Expand Down
36 changes: 36 additions & 0 deletions pytorch/src/gen/java/org/bytedeco/pytorch/FanModeType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Targeted by JavaCPP version 1.5.6-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.pytorch;

import org.bytedeco.pytorch.Allocator;
import org.bytedeco.pytorch.Function;
import org.bytedeco.pytorch.Module;
import java.nio.*;
import org.bytedeco.javacpp.*;
import org.bytedeco.javacpp.annotation.*;

import static org.bytedeco.javacpp.presets.javacpp.*;
import static org.bytedeco.openblas.global.openblas_nolapack.*;
import static org.bytedeco.openblas.global.openblas.*;

import static org.bytedeco.pytorch.global.torch.*;

@NoOffset @Name("c10::variant<torch::enumtype::kFanIn,torch::enumtype::kFanOut>") @Properties(inherit = org.bytedeco.pytorch.presets.torch.class)
public class FanModeType extends Pointer {
static { Loader.load(); }
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public FanModeType(Pointer p) { super(p); }
public FanModeType(kFanIn value) { this(); put(value); }
public FanModeType(kFanOut value) { this(); put(value); }
public FanModeType() { allocate(); }
private native void allocate();
public native @Name("operator =") @ByRef FanModeType put(@ByRef FanModeType x);

public @ByRef kFanIn get0() { return get0(this); }
@Namespace @Name("c10::get<0>") public static native @ByRef kFanIn get0(@ByRef FanModeType container);
@ValueSetter public native FanModeType put(@ByRef kFanIn value);
public @ByRef kFanOut get1() { return get1(this); }
@Namespace @Name("c10::get<1>") public static native @ByRef kFanOut get1(@ByRef FanModeType container);
@ValueSetter public native FanModeType put(@ByRef kFanOut value);
}

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class GridSampleFuncOptions extends Pointer {
return new GridSampleFuncOptions((Pointer)this).offsetAddress(i);
}

public native @Cast("torch::nn::functional::GridSampleFuncOptions::mode_t*") @ByRef @NoException Pointer mode();
public native @Cast("torch::nn::functional::GridSampleFuncOptions::padding_mode_t*") @ByRef @NoException Pointer padding_mode();
public native @ByRef @NoException grid_sample_mode_t mode();
public native @ByRef @NoException grid_sample_padding_mode_t padding_mode();
public native @ByRef @NoException BoolOptional align_corners();
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ public class HingeEmbeddingLossOptions extends Pointer {
}

public native @ByRef @NoException DoublePointer margin();
public native @Cast("torch::nn::HingeEmbeddingLossOptions::reduction_t*") @ByRef @NoException Pointer reduction();
public native @ByRef @NoException loss_reduction_t reduction();
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ public class HuberLossOptions extends Pointer {
private native void allocate(@ByVal kMean reduction);
public HuberLossOptions(@ByVal kSum reduction) { super((Pointer)null); allocate(reduction); }
private native void allocate(@ByVal kSum reduction);
public native @Cast("torch::nn::HuberLossOptions::reduction_t*") @ByRef @NoException Pointer reduction();
public native @ByRef @NoException loss_reduction_t reduction();
public native @ByRef @NoException DoublePointer delta();
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class InterpolateFuncOptions extends Pointer {

public native @ByRef @NoException LongVectorOptional size();
public native @ByRef @NoException DoubleVectorOptional scale_factor();
public native @Cast("torch::nn::functional::InterpolateFuncOptions::mode_t*") @ByRef @NoException Pointer mode();
public native @ByRef @NoException interpolate_mode_t mode();
public native @ByRef @NoException BoolOptional align_corners();
public native @ByRef @NoException BoolOptional recompute_scale_factor();
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ public class KLDivLossOptions extends Pointer {
private native void allocate(@ByVal kSum reduction);
public KLDivLossOptions(@ByVal kMean reduction) { super((Pointer)null); allocate(reduction); }
private native void allocate(@ByVal kMean reduction);
public native @Cast("torch::nn::KLDivLossOptions::reduction_t*") @ByRef @NoException Pointer reduction();
public native @ByRef @NoException kldiv_loss_reduction_t reduction();
public native @Cast("bool*") @ByRef @NoException BoolPointer log_target();
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ public class L1LossOptions extends Pointer {
private native void allocate(@ByVal kMean reduction);
public L1LossOptions(@ByVal kSum reduction) { super((Pointer)null); allocate(reduction); }
private native void allocate(@ByVal kSum reduction);
public native @Cast("torch::nn::L1LossOptions::reduction_t*") @ByRef @NoException Pointer reduction();
public native @ByRef @NoException loss_reduction_t reduction();
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ public class MSELossOptions extends Pointer {
private native void allocate(@ByVal kMean reduction);
public MSELossOptions(@ByVal kSum reduction) { super((Pointer)null); allocate(reduction); }
private native void allocate(@ByVal kSum reduction);
public native @Cast("torch::nn::MSELossOptions::reduction_t*") @ByRef @NoException Pointer reduction();
public native @ByRef @NoException loss_reduction_t reduction();
}
Loading

0 comments on commit 7b9ccf3

Please sign in to comment.