CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

Using @cntk.Function.with_signature gives an error

Open Arvinds-ds opened this issue 9 years ago • 1 comments

In the tutorial CNTK_050_GuidedTour.ipynb for Python , using the @Function(C.layers.Tensor[input_dim_lr], C.layers.SparseTensor[num_classes_lr]) outputs an Exception (Python 3.6, Windows)

File "C:\Users\ama\Anaconda3\Lib\site-packages\cntk\ops\functions.py", line 124, in _to_Function f_name = f.name # (only used for debugging and error messages) File "C:\Users\ama\Anaconda3\Lib\site-packages\cntk\variables.py", line 31, in getattr raise AttributeError("record has no attribute '{}'".format(key)) builtins.AttributeError: record has no attribute 'name'

Arvinds-ds avatar May 30 '17 20:05 Arvinds-ds

I tried the following which works

@C.Function
def criterion(x: C.layers.Tensor[5], y: C.layers.Tensor[10]):
    z = model(x)
    loss = C.cross_entropy_with_softmax(z,y)
    metrics = C.classification_error(z,y)
    return loss, metrics

but criterion does not have train function as indicated in the tutorial

Arvinds-ds avatar May 31 '17 01:05 Arvinds-ds