ext/torch/utils.h in torch-rb-0.12.0 vs ext/torch/utils.h in torch-rb-0.12.1

- old
+ new

@@ -15,10 +15,11 @@ throw Rice::Exception(rb_eRuntimeError, ex.what_without_backtrace()); } // keep THP prefix for now to make it easier to compare code +extern VALUE THPGeneratorClass; extern VALUE THPVariableClass; inline VALUE THPUtils_internSymbol(const std::string& str) { return Rice::Symbol(str); } @@ -40,9 +41,13 @@ return FIXNUM_P(obj); } inline bool THPUtils_checkScalar(VALUE obj) { return FIXNUM_P(obj) || RB_FLOAT_TYPE_P(obj) || RB_TYPE_P(obj, T_COMPLEX); +} + +inline bool THPGenerator_Check(VALUE obj) { + return rb_obj_is_kind_of(obj, THPGeneratorClass); } inline bool THPVariable_Check(VALUE obj) { return rb_obj_is_kind_of(obj, THPVariableClass); }