|
1 | | -# # Contains definitions for api from MPSGraphCore.h, MPSGraphDevice.h |
2 | 1 |
|
3 | | -# const MPSGraphTensorDataDictionary = NSDictionary#<MPSGraphTensor *,MPSGraphTensorData *> |
| 2 | +if MPS.is_supported(device()) |
4 | 3 |
|
5 | | -# ## MPSGraphCore.h |
6 | | -# @objcwrapper MPSGraphObject <: NSObject |
| 4 | +using .MPS: MPSShape |
| 5 | +using .MPSGraphs: MPSGraph, MPSGraphDevice |
| 6 | +@testset "Core" begin |
7 | 7 |
|
8 | | -# @objcwrapper MPSGraph <: MPSGraphObject |
| 8 | +graph = MPSGraph() |
| 9 | +@test graph isa MPSGraph |
9 | 10 |
|
10 | | -# function MPSGraph() |
11 | | -# MPSGraph(@objc [MPSGraph new]::id{MPSGraph}) |
12 | | -# end |
| 11 | +dev = device() |
| 12 | +graphdev = MPSGraphDevice(dev) |
| 13 | +@test graphdev isa MPSGraphDevice |
| 14 | +@test graphdev.type == MPSGraphs.MPSGraphDeviceTypeMetal |
| 15 | +@test graphdev.metalDevice == dev |
13 | 16 |
|
14 | | -# @objcwrapper MPSGraphType <: MPSGraphObject |
| 17 | +end # @testset "Core" |
15 | 18 |
|
16 | | -# @objcwrapper MPSGraphShapedType <: MPSGraphType |
17 | | - |
18 | | -# @objcproperties MPSGraphShapedType begin |
19 | | -# @autoproperty shape::id{MPSShape} setter=setShape |
20 | | -# @autoproperty dataType::MPSDataType setter=setDataType |
21 | | -# end |
22 | | - |
23 | | -# function MPSGraphShapedType(shape::MPSShape, dataType) |
24 | | -# tmp = @objc [MPSGraphShapedType alloc]::id{MPSGraphShapedType} |
25 | | -# obj = MPSGraphShapedType(tmp) |
26 | | -# finalizer(release, obj) |
27 | | -# @objc [obj::id{MPSGraphShapedType} initWithShape:shape::id{MPSShape} |
28 | | -# dataType:dataType::MPSDataType]::id{MPSGraphShapedType} |
29 | | - |
30 | | -# return obj |
31 | | -# end |
32 | | - |
33 | | -# ## MPSGraphDevice.h |
34 | | -# @objcwrapper MPSGraphDevice <: MPSGraphType |
35 | | - |
36 | | -# @objcproperties MPSGraphDevice begin |
37 | | -# @autoproperty type::MPSGraphDeviceType |
38 | | -# @autoproperty metalDevice::id{MTLDevice} |
39 | | -# end |
40 | | - |
41 | | -# function MPSGraphDevice(device::MTLDevice) |
42 | | -# obj = @objc [MPSGraphDevice deviceWithMTLDevice:device::id{MTLDevice}]::id{MPSGraphDevice} |
43 | | -# MPSGraphDevice(obj) |
44 | | -# end |
| 19 | +end # MPS.is_supported(device()) |
0 commit comments