Skip to content

Commit d7955c7

Browse files
committed
Ensure that integers in exported symbols have fixed sizes
1 parent 297f8cb commit d7955c7

19 files changed

+622
-622
lines changed

src/Native/LibTorchSharp/THSFFT.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Tensor THSTensor_ifft2(const Tensor tensor, const int64_t* s, const int64_t* dim
3636
CATCH_TENSOR(torch::fft::ifft2(*tensor, sArg, dArg, normArg));
3737
}
3838

39-
Tensor THSTensor_fftn(const Tensor tensor, const int64_t* s, const int s_length, const int64_t* dim, const int dim_length, int8_t norm)
39+
Tensor THSTensor_fftn(const Tensor tensor, const int64_t* s, const int32_t s_length, const int64_t* dim, const int32_t dim_length, int8_t norm)
4040
{
4141
auto normArg = (norm == 0) ? "backward" : (norm == 1) ? "forward" : "ortho";
4242
auto sArg = (s == nullptr) ? c10::nullopt : c10::optional<c10::IntArrayRef>(c10::IntArrayRef(s, s_length));
@@ -45,7 +45,7 @@ Tensor THSTensor_fftn(const Tensor tensor, const int64_t* s, const int s_length,
4545
CATCH_TENSOR(torch::fft::fftn(*tensor, sArg, dArg, normArg));
4646
}
4747

48-
Tensor THSTensor_ifftn(const Tensor tensor, const int64_t* s, const int s_length, const int64_t* dim, const int dim_length, int8_t norm)
48+
Tensor THSTensor_ifftn(const Tensor tensor, const int64_t* s, const int32_t s_length, const int64_t* dim, const int32_t dim_length, int8_t norm)
4949
{
5050
auto normArg = (norm == 0) ? "backward" : (norm == 1) ? "forward" : "ortho";
5151
auto sArg = (s == nullptr) ? c10::nullopt : c10::optional<c10::IntArrayRef>(c10::IntArrayRef(s, s_length));
@@ -69,7 +69,7 @@ Tensor THSTensor_hfft2(const Tensor tensor, const int64_t* s, const int64_t* dim
6969
CATCH_TENSOR(torch::fft::hfft2(*tensor, sArg, dArg, normArg));
7070
}
7171

72-
Tensor THSTensor_hfftn(const Tensor tensor, const int64_t* s, const int s_length, const int64_t* dim, const int dim_length, int8_t norm)
72+
Tensor THSTensor_hfftn(const Tensor tensor, const int64_t* s, const int32_t s_length, const int64_t* dim, const int32_t dim_length, int8_t norm)
7373
{
7474
auto normArg = (norm == 0) ? "backward" : (norm == 1) ? "forward" : "ortho";
7575
auto sArg = (s == nullptr) ? c10::nullopt : c10::optional<c10::IntArrayRef>(c10::IntArrayRef(s, s_length));
@@ -93,7 +93,7 @@ Tensor THSTensor_ihfft2(const Tensor tensor, const int64_t* s, const int64_t* di
9393
CATCH_TENSOR(torch::fft::ihfft2(*tensor, sArg, dArg, normArg));
9494
}
9595

96-
Tensor THSTensor_ihfftn(const Tensor tensor, const int64_t* s, const int s_length, const int64_t* dim, const int dim_length, int8_t norm)
96+
Tensor THSTensor_ihfftn(const Tensor tensor, const int64_t* s, const int32_t s_length, const int64_t* dim, const int32_t dim_length, int8_t norm)
9797
{
9898
auto normArg = (norm == 0) ? "backward" : (norm == 1) ? "forward" : "ortho";
9999
auto sArg = (s == nullptr) ? c10::nullopt : c10::optional<c10::IntArrayRef>(c10::IntArrayRef(s, s_length));
@@ -134,7 +134,7 @@ Tensor THSTensor_irfft2(const Tensor tensor, const int64_t* s, const int64_t* di
134134
CATCH_TENSOR(torch::fft::irfft2(*tensor, sArg, dArg, normArg));
135135
}
136136

137-
Tensor THSTensor_rfftn(const Tensor tensor, const int64_t* s, const int s_length, const int64_t* dim, const int dim_length, int8_t norm)
137+
Tensor THSTensor_rfftn(const Tensor tensor, const int64_t* s, const int32_t s_length, const int64_t* dim, const int32_t dim_length, int8_t norm)
138138
{
139139
auto normArg = (norm == 0) ? "backward" : (norm == 1) ? "forward" : "ortho";
140140
auto sArg = (s == nullptr) ? c10::nullopt : c10::optional<c10::IntArrayRef>(c10::IntArrayRef(s, s_length));
@@ -143,7 +143,7 @@ Tensor THSTensor_rfftn(const Tensor tensor, const int64_t* s, const int s_length
143143
CATCH_TENSOR(torch::fft::rfftn(*tensor, sArg, dArg, normArg));
144144
}
145145

146-
Tensor THSTensor_irfftn(const Tensor tensor, const int64_t* s, const int s_length, const int64_t* dim, const int dim_length, int8_t norm)
146+
Tensor THSTensor_irfftn(const Tensor tensor, const int64_t* s, const int32_t s_length, const int64_t* dim, const int32_t dim_length, int8_t norm)
147147
{
148148
auto normArg = (norm == 0) ? "backward" : (norm == 1) ? "forward" : "ortho";
149149
auto sArg = (s == nullptr) ? c10::nullopt : c10::optional<c10::IntArrayRef>(c10::IntArrayRef(s, s_length));
@@ -152,7 +152,7 @@ Tensor THSTensor_irfftn(const Tensor tensor, const int64_t* s, const int s_lengt
152152
CATCH_TENSOR(torch::fft::irfftn(*tensor, sArg, dArg, normArg));
153153
}
154154

155-
Tensor THSTensor_fftfreq(const int64_t n, const double d, const int8_t scalar_type, const int device_type, const int device_index, const bool requires_grad)
155+
Tensor THSTensor_fftfreq(const int64_t n, const double d, const int8_t scalar_type, const int32_t device_type, const int32_t device_index, const bool requires_grad)
156156
{
157157
auto options = at::TensorOptions()
158158
.dtype(at::ScalarType(scalar_type))
@@ -162,7 +162,7 @@ Tensor THSTensor_fftfreq(const int64_t n, const double d, const int8_t scalar_ty
162162
CATCH_TENSOR(d == 0.0 ? torch::fft::fftfreq(n, options) : torch::fft::fftfreq(n, d, options));
163163
}
164164

165-
Tensor THSTensor_rfftfreq(const int64_t n, const double d, const int8_t scalar_type, const int device_type, const int device_index, const bool requires_grad)
165+
Tensor THSTensor_rfftfreq(const int64_t n, const double d, const int8_t scalar_type, const int32_t device_type, const int32_t device_index, const bool requires_grad)
166166
{
167167
auto options = at::TensorOptions()
168168
.dtype(at::ScalarType(scalar_type))
@@ -172,13 +172,13 @@ Tensor THSTensor_rfftfreq(const int64_t n, const double d, const int8_t scalar_t
172172
CATCH_TENSOR(d == 0.0 ? torch::fft::rfftfreq(n, options) : torch::fft::rfftfreq(n, d, options));
173173
}
174174

175-
Tensor THSTensor_fftshift(const Tensor tensor, const int64_t* dim, const int dim_length)
175+
Tensor THSTensor_fftshift(const Tensor tensor, const int64_t* dim, const int32_t dim_length)
176176
{
177177
auto dArg = (dim == nullptr) ? c10::nullopt : c10::optional<c10::IntArrayRef>(c10::IntArrayRef(dim, dim_length));
178178
CATCH_TENSOR(torch::fft::fftshift(*tensor, dArg));
179179
}
180180

181-
Tensor THSTensor_ifftshift(const Tensor tensor, const int64_t* dim, const int dim_length)
181+
Tensor THSTensor_ifftshift(const Tensor tensor, const int64_t* dim, const int32_t dim_length)
182182
{
183183
auto dArg = (dim == nullptr) ? c10::nullopt : c10::optional<c10::IntArrayRef>(c10::IntArrayRef(dim, dim_length));
184184
CATCH_TENSOR(torch::fft::ifftshift(*tensor, dArg));

src/Native/LibTorchSharp/THSJIT.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,12 @@ TensorOrScalar* ReturnHelper(c10::IValue result, TensorOrScalar* (*allocator)(in
405405
return nullptr;
406406
}
407407

408-
c10::impl::GenericList toScalarValueList(const TensorOrScalar* tensorPtrs, const int length)
408+
c10::impl::GenericList toScalarValueList(const TensorOrScalar* tensorPtrs, const int32_t length)
409409
{
410410
auto list = c10::impl::GenericList(c10::ScalarTypeType::get());
411411

412412
if (tensorPtrs != nullptr) {
413-
for (int i = 0; i < length; i++)
413+
for (int32_t i = 0; i < length; i++)
414414
{
415415
switch (tensorPtrs[i].TypeCode) {
416416
case 1:
@@ -423,12 +423,12 @@ c10::impl::GenericList toScalarValueList(const TensorOrScalar* tensorPtrs, const
423423
return list;
424424
}
425425

426-
c10::impl::GenericList toTensorValueList(const TensorOrScalar* tensorPtrs, const int length)
426+
c10::impl::GenericList toTensorValueList(const TensorOrScalar* tensorPtrs, const int32_t length)
427427
{
428428
auto list = c10::impl::GenericList(c10::TensorType::get());
429429

430430
if (tensorPtrs != nullptr) {
431-
for (int i = 0; i < length; i++)
431+
for (int32_t i = 0; i < length; i++)
432432
{
433433
switch (tensorPtrs[i].TypeCode) {
434434
case 0:
@@ -441,7 +441,7 @@ c10::impl::GenericList toTensorValueList(const TensorOrScalar* tensorPtrs, const
441441
return list;
442442
}
443443

444-
std::vector<c10::IValue> toIValue(const TensorOrScalar* tensorPtrs, const int length)
444+
std::vector<c10::IValue> toIValue(const TensorOrScalar* tensorPtrs, const int32_t length)
445445
{
446446
// TypeCode:
447447
//
@@ -456,7 +456,7 @@ std::vector<c10::IValue> toIValue(const TensorOrScalar* tensorPtrs, const int le
456456
std::vector<c10::IValue> tensors;
457457

458458
if (tensorPtrs != nullptr) {
459-
for (int i = 0; i < length; i++)
459+
for (int32_t i = 0; i < length; i++)
460460
{
461461
switch (tensorPtrs[i].TypeCode) {
462462
case 0:
@@ -495,7 +495,7 @@ std::vector<c10::IValue> toIValue(const TensorOrScalar* tensorPtrs, const int le
495495
return tensors;
496496
}
497497

498-
void THSJIT_Module_forward(const JITModule module, const TensorOrScalar* tensorPtrs, const int length, TensorOrScalar* (*allocator)(int32_t idx, size_t length), int8_t* typeCode, int32_t idx)
498+
void THSJIT_Module_forward(const JITModule module, const TensorOrScalar* tensorPtrs, const int32_t length, TensorOrScalar* (*allocator)(int32_t idx, size_t length), int8_t* typeCode, int32_t idx)
499499
{
500500
*typeCode = 0;
501501

@@ -505,7 +505,7 @@ void THSJIT_Module_forward(const JITModule module, const TensorOrScalar* tensorP
505505
)
506506
}
507507

508-
void THSJIT_Module_invoke(const JITModule module, const char* name, const TensorOrScalar* tensorPtrs, const int length, TensorOrScalar* (*allocator)(int32_t idx, size_t length), int8_t* typeCode, int32_t idx)
508+
void THSJIT_Module_invoke(const JITModule module, const char* name, const TensorOrScalar* tensorPtrs, const int32_t length, TensorOrScalar* (*allocator)(int32_t idx, size_t length), int8_t* typeCode, int32_t idx)
509509
{
510510
*typeCode = 0;
511511

@@ -516,7 +516,7 @@ void THSJIT_Module_invoke(const JITModule module, const char* name, const Tensor
516516
)
517517
}
518518

519-
void THSJIT_CompilationUnit_Invoke(const JITCompilationUnit module, const char* method, const TensorOrScalar* tensorPtrs, const int length, TensorOrScalar* (*allocator)(int32_t idx, size_t length), int8_t* typeCode, int32_t idx)
519+
void THSJIT_CompilationUnit_Invoke(const JITCompilationUnit module, const char* method, const TensorOrScalar* tensorPtrs, const int32_t length, TensorOrScalar* (*allocator)(int32_t idx, size_t length), int8_t* typeCode, int32_t idx)
520520
{
521521
*typeCode = 0;
522522

@@ -538,19 +538,19 @@ const char* THSJIT_Method_name(const JITMethod method)
538538
return make_sharable_string((*method)->name());
539539
}
540540

541-
int THSJIT_Method_num_inputs(const JITMethod method)
541+
int32_t THSJIT_Method_num_inputs(const JITMethod method)
542542
{
543-
return (int)(*method)->num_inputs();
543+
return (int32_t)(*method)->num_inputs();
544544
}
545545

546-
int THSJIT_Module_num_inputs(const JITModule module)
546+
int32_t THSJIT_Module_num_inputs(const JITModule module)
547547
{
548-
return (int)(*module)->get_method("forward").num_inputs() - 1; // Don't count the 'self' argument.
548+
return (int32_t)(*module)->get_method("forward").num_inputs() - 1; // Don't count the 'self' argument.
549549
}
550550

551-
int THSJIT_Module_num_outputs(const JITModule module)
551+
int32_t THSJIT_Module_num_outputs(const JITModule module)
552552
{
553-
return (int)(*module)->get_method("forward").function().getSchema().returns().size();
553+
return (int32_t)(*module)->get_method("forward").function().getSchema().returns().size();
554554
}
555555

556556
JITFunction THSJIT_Method_function(const JITMethod method)
@@ -567,9 +567,9 @@ void THSJIT_Method_dispose(const JITMethod method)
567567
//-------------------------------------------------------------------------------------
568568
// JITFunction
569569

570-
int THSJIT_Function_num_inputs(const JITFunction function)
570+
int32_t THSJIT_Function_num_inputs(const JITFunction function)
571571
{
572-
return (int)(*function)->num_inputs();
572+
return (int32_t)(*function)->num_inputs();
573573
}
574574

575575
// TODO other function operations

src/Native/LibTorchSharp/THSJIT.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ EXPORT_API(JITCompilationUnit) THSJIT_compile(const char* script);
3535
EXPORT_API(void) THSJIT_Module_dispose(const JITModule module);
3636
EXPORT_API(void) THSJIT_CompilationUnit_dispose(const JITCompilationUnit module);
3737

38-
EXPORT_API(int) THSJIT_Module_num_inputs(const JITModule method);
39-
EXPORT_API(int) THSJIT_Module_num_outputs(const JITModule method);
38+
EXPORT_API(int32_t) THSJIT_Module_num_inputs(const JITModule method);
39+
EXPORT_API(int32_t) THSJIT_Module_num_outputs(const JITModule method);
4040

41-
EXPORT_API(void) THSJIT_Module_forward(const JITModule module, const TensorOrScalar* tensorPtrs, const int length, TensorOrScalar* (*allocator)(int32_t idx, size_t length), int8_t* typeCode, int32_t idx);
42-
EXPORT_API(void) THSJIT_Module_invoke(const JITModule module, const char* name, const TensorOrScalar* tensorPtrs, const int length, TensorOrScalar* (*allocator)(int32_t idx, size_t length), int8_t* typeCode, int32_t idx);
41+
EXPORT_API(void) THSJIT_Module_forward(const JITModule module, const TensorOrScalar* tensorPtrs, const int32_t length, TensorOrScalar* (*allocator)(int32_t idx, size_t length), int8_t* typeCode, int32_t idx);
42+
EXPORT_API(void) THSJIT_Module_invoke(const JITModule module, const char* name, const TensorOrScalar* tensorPtrs, const int32_t length, TensorOrScalar* (*allocator)(int32_t idx, size_t length), int8_t* typeCode, int32_t idx);
4343

44-
EXPORT_API(void) THSJIT_CompilationUnit_Invoke(const JITCompilationUnit module, const char* method, const TensorOrScalar* tensorPtrs, const int length, TensorOrScalar* (*allocator)(int32_t idx, size_t length), int8_t* typeCode, int32_t idx);
44+
EXPORT_API(void) THSJIT_CompilationUnit_Invoke(const JITCompilationUnit module, const char* method, const TensorOrScalar* tensorPtrs, const int32_t length, TensorOrScalar* (*allocator)(int32_t idx, size_t length), int8_t* typeCode, int32_t idx);
4545

4646
EXPORT_API(int) THSJIT_Module_is_training(JITModule module);
4747
EXPORT_API(void) THSJIT_Module_zero_grad(const JITModule module, bool set_to_none);
@@ -89,7 +89,7 @@ EXPORT_API(void) THSJIT_Module_named_attributes(const JITModule module, bool rec
8989

9090
EXPORT_API(void) THSJIT_Module_set_attribute(const JITModule module, const char* name, Tensor tensor);
9191

92-
EXPORT_API(int) THSJIT_Method_num_inputs(const JITMethod method);
92+
EXPORT_API(int32_t) THSJIT_Method_num_inputs(const JITMethod method);
9393

9494
EXPORT_API(void) THSJIT_Method_dispose(const JITMethod method);
9595

src/Native/LibTorchSharp/THSLinearAlgebra.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Tensor THSLinalg_cholesky_ex(const Tensor tensor, bool check_errors, Tensor* inf
1717
return ResultTensor(std::get<0>(res));
1818
}
1919

20-
Tensor THSLinalg_cond_int(const Tensor tensor, const int p)
20+
Tensor THSLinalg_cond_int(const Tensor tensor, const int32_t p)
2121
{
2222
CATCH_TENSOR(torch::linalg_cond(*tensor, p))
2323
}
@@ -187,19 +187,19 @@ Tensor THSLinalg_ldl_solve(const Tensor LD, const Tensor pivots, const Tensor B,
187187
CATCH_TENSOR(torch::linalg_ldl_solve(*LD, *pivots, *B, hermitian))
188188
}
189189

190-
Tensor THSLinalg_matrix_norm(const Tensor tensor, const Scalar ord, const int64_t* dim, const int dim_length, const bool keepdim)
190+
Tensor THSLinalg_matrix_norm(const Tensor tensor, const Scalar ord, const int64_t* dim, const int32_t dim_length, const bool keepdim)
191191
{
192192
auto dims = c10::ArrayRef<int64_t>(dim, dim_length);
193193
CATCH_TENSOR(torch::linalg_matrix_norm(*tensor, *ord, dims, keepdim, c10::nullopt))
194194
}
195195

196-
Tensor THSLinalg_matrix_norm_fronuc(const Tensor tensor, const int8_t fronuc, const int64_t* dim, const int dim_length, const bool keepdim)
196+
Tensor THSLinalg_matrix_norm_fronuc(const Tensor tensor, const int8_t fronuc, const int64_t* dim, const int32_t dim_length, const bool keepdim)
197197
{
198198
auto dims = c10::ArrayRef<int64_t>(dim, dim_length);
199199
CATCH_TENSOR(torch::linalg_matrix_norm(*tensor, (fronuc == 0) ? "fro" : "nuc", dims, keepdim, c10::nullopt))
200200
}
201201

202-
Tensor THSLinalg_vector_norm(const Tensor tensor, const Scalar ord, const int64_t* dim, const int dim_length, const bool keepdim)
202+
Tensor THSLinalg_vector_norm(const Tensor tensor, const Scalar ord, const int64_t* dim, const int32_t dim_length, const bool keepdim)
203203
{
204204
auto dims = c10::ArrayRef<int64_t>(dim, dim_length);
205205
CATCH_TENSOR(torch::linalg_vector_norm(*tensor, *ord, dims, keepdim, c10::nullopt))
@@ -226,30 +226,30 @@ Tensor THSLinalg_matrix_power(const Tensor tensor, const int64_t n)
226226
CATCH_TENSOR(torch::linalg_matrix_power(*tensor, n))
227227
}
228228

229-
Tensor THSLinalg_multi_dot(const Tensor* tensors, const int length)
229+
Tensor THSLinalg_multi_dot(const Tensor* tensors, const int32_t length)
230230
{
231231
CATCH_TENSOR(torch::linalg_multi_dot(toTensors<at::Tensor>((torch::Tensor**)tensors, length)))
232232
}
233233

234-
Tensor THSLinalg_norm_str(const Tensor tensor, const char* p, const int64_t* dim, const int dim_length, const bool keepdim)
234+
Tensor THSLinalg_norm_str(const Tensor tensor, const char* p, const int64_t* dim, const int32_t dim_length, const bool keepdim)
235235
{
236236
c10::optional<at::IntArrayRef> dims = (dim == nullptr) ? c10::nullopt : c10::optional<at::IntArrayRef>(at::ArrayRef<int64_t>(dim, dim_length));
237237
CATCH_TENSOR(torch::linalg_norm(*tensor, p, dims, keepdim, c10::nullopt))
238238
}
239239

240-
Tensor THSLinalg_norm_float(const Tensor tensor, const double p, const int64_t* dim, const int dim_length, const bool keepdim)
240+
Tensor THSLinalg_norm_float(const Tensor tensor, const double p, const int64_t* dim, const int32_t dim_length, const bool keepdim)
241241
{
242242
c10::optional<at::IntArrayRef> dims = (dim == nullptr) ? c10::nullopt : c10::optional<at::IntArrayRef>(at::ArrayRef<int64_t>(dim, dim_length));
243243
CATCH_TENSOR(torch::linalg_norm(*tensor, p, dims, keepdim, c10::nullopt))
244244
}
245245

246-
Tensor THSLinalg_norm_int(const Tensor tensor, const int p, const int64_t* dim, const int dim_length, const bool keepdim)
246+
Tensor THSLinalg_norm_int(const Tensor tensor, const int32_t p, const int64_t* dim, const int32_t dim_length, const bool keepdim)
247247
{
248248
c10::optional<at::IntArrayRef> dims = (dim == nullptr) ? c10::nullopt : c10::optional<at::IntArrayRef>(at::ArrayRef<int64_t>(dim, dim_length));
249249
CATCH_TENSOR(torch::linalg_norm(*tensor, p, dims, keepdim, c10::nullopt))
250250
}
251251

252-
Tensor THSLinalg_norm_opt(const Tensor tensor, const int64_t* dim, const int dim_length, const bool keepdim)
252+
Tensor THSLinalg_norm_opt(const Tensor tensor, const int64_t* dim, const int32_t dim_length, const bool keepdim)
253253
{
254254
c10::optional<at::IntArrayRef> dims = (dim == nullptr) ? c10::nullopt : c10::optional<at::IntArrayRef>(at::ArrayRef<int64_t>(dim, dim_length));
255255
CATCH_TENSOR(torch::linalg_norm(*tensor, c10::nullopt, dims, keepdim, c10::nullopt))
@@ -276,7 +276,7 @@ Tensor THSLinalg_pinverse(const Tensor tensor, const double rcond, const bool he
276276
CATCH_TENSOR(torch::linalg_pinv(*tensor, rcond, hermitian))
277277
}
278278

279-
Tensor THSLinalg_qr(const Tensor tensor, const char mode, Tensor* R)
279+
Tensor THSLinalg_qr(const Tensor tensor, const uint8_t mode, Tensor* R)
280280
{
281281
std::tuple<at::Tensor, at::Tensor> res;
282282
if (mode == 0) {
@@ -335,7 +335,7 @@ Tensor THSLinalg_tensorinv(const Tensor tensor, const int64_t ind)
335335
CATCH_TENSOR(torch::linalg_tensorinv(*tensor, ind))
336336
}
337337

338-
Tensor THSLinalg_tensorsolve(const Tensor tensor, Tensor other, const int64_t* dim, const int dim_length)
338+
Tensor THSLinalg_tensorsolve(const Tensor tensor, Tensor other, const int64_t* dim, const int32_t dim_length)
339339
{
340340
c10::optional<at::IntArrayRef> dims = (dim == nullptr) ? c10::nullopt : c10::optional<at::IntArrayRef>(at::ArrayRef<int64_t>(dim, dim_length));
341341
CATCH_TENSOR(torch::linalg_tensorsolve(*tensor, *other, dims))
@@ -467,9 +467,9 @@ Tensor THSLinalg_tensordot(
467467
const Tensor input1,
468468
const Tensor input2,
469469
const int64_t* dims1,
470-
const int dims1_length,
470+
const int32_t dims1_length,
471471
const int64_t* dims2,
472-
const int dims2_length)
472+
const int32_t dims2_length)
473473
{
474474
auto d1 = c10::ArrayRef<int64_t>(dims1, dims1_length);
475475
auto d2 = c10::ArrayRef<int64_t>(dims2, dims2_length);

src/Native/LibTorchSharp/THSModule.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,12 @@ void THSNN_Module_get_named_modules(const NNModule module, NNModule* (*allocator
161161
}
162162
}
163163

164-
long THSNN_Module_children_size(const NNModule module)
164+
size_t THSNN_Module_children_size(const NNModule module)
165165
{
166166
return (*module)->children().size();
167167
}
168168

169-
NNModule THSNN_Module_child(const NNModule module, const int index)
169+
NNModule THSNN_Module_child(const NNModule module, const int32_t index)
170170
{
171171
return new std::shared_ptr<torch::nn::Module>((*module)->children()[index]);
172172
}

0 commit comments

Comments
 (0)