Post not yet marked as solved
I need to reshape a tensor A to shape S that is not available at the compile time. I would like to compute the shape S inside the graph and then reshape the tensor A to the shape S. Is this even possible with MPS?
Post not yet marked as solved
I already installed tensorflow latest version using the documentation given (link). But when I tried to run notebook with command "%tensorflow_version 2.x" , its giving error "UsageError: Line magic function %tensorflow_version not found.". Please tell me, what to do ?
Post not yet marked as solved
I already installed tensorflow latest version using the documentation given (link). But when I tried to run notebook with command "%tensorflow_version 2.x" , its giving error "UsageError: Line magic function %tensorflow_version not found.". Please tell me, what to do ?
Hello,
printing the dataType property some tensor, results in a non-disclosing "MPSDataType" string. Is this intended? If so, how do I get string representation of type of the tensor please?
let graph = MPSGraph()
print(graph.constant(23.0, dataType: .float32).dataType)
// prints "MPSDataType", and not "f32" or something useful
Post not yet marked as solved
Hello,
I am trying to implement numpy.arrange using MPSGraph primitives. Along the way I got to this code, which I would expect is correct, however the program crashes with information about type mismatch.
What am I doing wrong?
Code
let G = MPSGraph()
let length = G.constant(9, shape: [1], dataType: .int32)
let base = G.constant(1, shape: [1], dataType: .int32)
let template = G.broadcast(base, shapeTensor: length, name: nil)
let r = G.for(
numberOfIterations: length,
initialBodyArguments: [template],
// just return the argument
body: { i, args in [args[0]] },
name: nil
)
Error
-:22:11: error: 'scf.for' op types mismatch between 0th iter operand and defined value
-:22:11: note: see current operation: %19 = "scf.for"(%16, %17, %18, %12) ( {
^bb0(%arg1: index, %arg2: tensor<*xi32>): // no predecessors
%21 = "tensor.from_elements"(%arg1) : (index) -> tensor<1xindex>
%22 = "mps.cast"(%21) {resultElementType = i32} : (tensor<1xindex>) -> tensor<1xi32>
"scf.yield"(%arg2) : (tensor<*xi32>) -> ()
}) : (index, index, index, tensor<9xi32>) -> tensor<*xi32>
/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph_Sim/MetalPerformanceShadersGraph-2.0.22/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphExecutable.mm:1052: failed assertion `Error: MLIR pass manager failed'
P.S. Is there a way I can return differently-shaped tensor from each iteration? In other words:
body: { i, args in
[G.concatTensors([args[0], i], dimension: 0, name: nil)]
}
Post not yet marked as solved
I'm working on an iOS framework that will be integrated into customer applications and I've added some ML functionality for the host apps to use. My framework is open source and licensed to my customers, therefore I would like to bundle the CoreML model as an encrypted and compiled asset within the framework. According to this WWDC video, it seems like it should be possible: https://developer.apple.com/videos/play/wwdc2020/10152/
I've made a quick test app, compiled and encrypted the model and added it to the "Copy Files Build Phase" of my Framework. However upon calling the load method of my model class, I receive the following error:
Error Domain=com.apple.CoreML Code=3 "failed to invoke mremap_encrypted with result = -1
I've checked the package contents of my test app, and I see within it my Framework.bundle (with _CodeSignature) is there and within that I see my Model.mlmodelc file. Everything seems to be in place and signed correctly.
The video states that model decryption keys are associated with a Developer Team and are automatically downloaded when needed. How is this done exactly? Do the keys need to belong to the team of the running application or can they belong to the Team of a framework developer?
Any help would be much appreciated. Thanks.
Hello, developers,
I'm implementing slice rendering of 3d volume.
And then, I have a simple question...
I use a simple vertex buffer type both in swift code and in metal code. Firstly, I defined uv to float2 but it's not working. It has weird texture coordinates when I use float2...
public struct VertexIn: sizeable {
var position = float3()
var normal = float3()
var uv = float3()
}
struct VertexIn {
float3 position [[ attribute(0) ]];
float3 normal [[ attribute(1) ]];
float3 uv [[ attribute(2) ]];
};
like this
float2.
float3.
It has just difference at the uv type. And I have same issue at passing uniform to shader. When I pass uniform that includes float or short types it doesn't work. So I change type to float3... So I inquire that metal data type is so difference compared with swift type??? Or what types are same and supported from metal.