You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For Mnist-1M.circuit from zoo, seems the cpu version returning wrong labels. For other zoo circuits like mnist.circuit or mnist-meduim.circuit they seem to fully match.
Code to reproduce:
using Revise
using LogicCircuits
using ProbabilisticCircuits
using DiscriminativeCircuits
using MLDatasets
using DataFrames: DataFrame
using Statistics
functionmnist()
# transposing makes slicing by variable much much faster# need to take a copy to physically move the data around
train_x =collect(Float32, transpose(reshape(MNIST.traintensor(), 28*28, :)))
test_x =collect(Float32, transpose(reshape(MNIST.testtensor(), 28*28, :)))
train_x =DataFrame(train_x, :auto)
test_x =DataFrame(test_x, :auto)
train_y::Vector{Int32}= MNIST.trainlabels()
test_y::Vector{Int32}= MNIST.testlabels()
return train_x, train_y, test_x, test_y
endfunctionmain()
circuit_name ="mnist-1M.circuit"
lc =zoo_dc(circuit_name)
println("Loaded zoo($(circuit_name) with $(num_classes(lc)) classes")
@timebegin
mnist_train, train_y, mnist_test, test_y =mnist();
mnist_train, _, mnist_test =threshold(mnist_train[:, 1:end-1], nothing, mnist_test[:, 1:end-1], 0.5);
end# WARMuppredict_class(lc, num_classes(lc), mnist_train[1:3,:])
predict_class(lc, num_classes(lc), to_gpu(mnist_train[1:3,:]))
@time pred =predict_class(lc, num_classes(lc), mnist_train)
pred .-=1# does not return lables its return the index of the label
acc =mean( pred .== train_y )
println("\t [CPU] Accuray = $( acc )")
@time pred_gpu =predict_class(lc, num_classes(lc), to_gpu(mnist_train))
pred_gpu .-=1
acc =mean( to_cpu(pred_gpu) .== train_y )
println("\t [GPU] Accuray = $( acc )")
println("CPU - GPU Match $( mean( to_cpu(pred_gpu) .== pred ) );")
println(train_y[1:10])
println(pred[1:10])
println(to_cpu(pred_gpu)[1:10])
end
For
Mnist-1M.circuit
from zoo, seems the cpu version returning wrong labels. For other zoo circuits likemnist.circuit
ormnist-meduim.circuit
they seem to fully match.Code to reproduce:
output:
The text was updated successfully, but these errors were encountered: