ext/torch/templates.h in torch-rb-0.8.3 vs ext/torch/templates.h in torch-rb-0.9.0
- old
+ new
@@ -39,28 +39,10 @@
}
#define RETURN_NIL \
return Qnil;
-class OptionalTensor {
- torch::Tensor value;
- public:
- OptionalTensor(Object o) {
- if (o.is_nil()) {
- value = {};
- } else {
- value = Rice::detail::From_Ruby<torch::Tensor>().convert(o.value());
- }
- }
- OptionalTensor(torch::Tensor o) {
- value = o;
- }
- operator torch::Tensor() const {
- return value;
- }
-};
-
namespace Rice::detail
{
template<>
struct Type<FanModeType>
{
@@ -126,28 +108,9 @@
} else if (s == "leaky_relu") {
return torch::kLeakyReLU;
} else {
throw std::runtime_error("Unsupported nonlinearity type: " + s);
}
- }
- };
-
- template<>
- struct Type<OptionalTensor>
- {
- static bool verify()
- {
- return true;
- }
- };
-
- template<>
- class From_Ruby<OptionalTensor>
- {
- public:
- OptionalTensor convert(VALUE x)
- {
- return OptionalTensor(x);
}
};
template<>
struct Type<Scalar>