ext/torch/ext.cpp in torch-rb-0.1.6 vs ext/torch/ext.cpp in torch-rb-0.1.7

- old
+ new

@@ -104,9 +104,16 @@ *[](IntArrayRef size, const torch::TensorOptions &options) { return torch::zeros(size, options); }) // begin operations .define_singleton_method( + "_save", + *[](const Tensor &value) { + auto v = torch::pickle_save(value); + std::string str(v.begin(), v.end()); + return str; + }) + .define_singleton_method( "_binary_cross_entropy_with_logits", *[](const Tensor &input, const Tensor &target, OptionalTensor weight, OptionalTensor pos_weight, MyReduction reduction) { return torch::binary_cross_entropy_with_logits(input, target, weight, pos_weight, reduction); }) .define_singleton_method(