IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 23, 2018, 1:24:10 PM (8 years ago)
Author:
eugene
Message:

fix segfault for nnet

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.data/nnet_commands.c

    r40319 r40320  
    1414int nnet_delete (int argc, char **argv) {
    1515
    16 # if (0)
    1716  int status;
    1817  Nnet *nnet;
     
    3130  status = DeleteNnet (nnet);
    3231  if (!status) abort ();
    33 # endif
    34 
    35   return TRUE;
    36 }
    37 
    38 int nnet_show (int argc, char **argv) {
    39 
    40 # if (0)
    41   Nnet *nnet;
    42 
    43   if (argc != 2) {
    44     gprint (GP_ERR, "USAGE: nnet listnnet (nnet)\n");
    45     return FALSE;
    46   }
    47 
    48   nnet = FindNnet (argv[1]);
    49   if (nnet == NULL) {
    50     gprint (GP_ERR, "nnet %s not found\n", argv[1]);
    51     return FALSE;
    52   }
    53 
    54   ListPages (nnet);
    55 # endif
    5632
    5733  return TRUE;
     
    6036int nnet_create (int argc, char **argv) {
    6137
    62   if (argc < 5) {
     38  if (argc < 4) {
    6339    gprint (GP_ERR, "USAGE: nnet create (nnet) (Ninput) [Nnodes] [Nnodes] ... (Noutput)\n");
    6440    return FALSE;
     
    8662  Vector *vector;
    8763
    88   if (argc < 5) {
     64  if (argc < 4) {
    8965    gprint (GP_ERR, "USAGE: nnet set (nnet) [weights] [biases] ... [weights] [biases] : set nnet weights (images) and biases (vectors)\n");
    9066    return FALSE;
     
    9874
    9975  // compare argc and nnet[0].Nlayer
    100   if (argc - 2 != nnet[0].Nlayer * 2) {
     76  if (argc - 2 != (nnet[0].Nlayer - 1) * 2) {
    10177    gprint (GP_ERR, "ERROR: invalid number of arguments\n");
    10278    gprint (GP_ERR, "USAGE: nnet set (nnet) [weights] [biases] ... [weights] [biases] : set nnet weights (images) and biases (vectors)\n");
     
    164140  Vector *vector;
    165141
    166   if (argc < 5) {
     142  if (argc < 4) {
    167143    gprint (GP_ERR, "USAGE: nnet get (nnet) [weights] [biases] ... [weights] [biases] : get nnet weights (images) and biases (vectors)\n");
    168144    return FALSE;
     
    176152
    177153  // compare argc and nnet[0].Nlayer
    178   if (argc - 2 != nnet[0].Nlayer * 2) {
     154  if (argc - 2 != (nnet[0].Nlayer - 1) * 2) {
    179155    gprint (GP_ERR, "ERROR: invalid number of arguments\n");
    180156    gprint (GP_ERR, "USAGE: nnet set (nnet) [weights] [biases] ... [weights] [biases] : set nnet weights (images) and biases (vectors)\n");
Note: See TracChangeset for help on using the changeset viewer.