torch_dart 0.0.3
torch_dart: ^0.0.3 copied to clipboard
Backend-independent Dart bindings for PyTorch.
example/torch_dart_example.dart
import 'package:torch_dart/torch_dart.dart' as torch;
import 'package:torch_dart/torch_dart.dart' show Torch;
void main() {
print('PyTorch: ${Torch.version}');
final x = torch.zeros([2, 3], dtype: .int32, device: .parse('cuda:0'));
print(x);
print(x.shape);
print(x.dtype);
print(x.device);
final y = torch.arange(12);
print(y);
final z = y.reshape([3, 4]);
print(z);
}